From c3ab060b788f5268efe1fdbea491260554986009 Mon Sep 17 00:00:00 2001 From: pbastowski Date: Tue, 27 Mar 2018 19:39:03 +0200 Subject: [PATCH 1/6] Add relativeTo query parameter relativeTo is used to strip a matching prefix from the absolute path of the input html file. --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 59bd703..8166416 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,7 @@ module.exports = function (source) { var outputPath; var outputSource = ''; + var relativeTo = query.relativeTo || ''; var prefix = query.prefix || ''; var module = query.module ? query.module : 'ng'; @@ -25,9 +26,9 @@ module.exports = function (source) { root = root.replace(/\\/g, separator); if (prefix) { - outputPath = prefix + resourcePath.replace(root, ''); + outputPath = prefix + resourcePath.replace(root, '').replace(relativeTo, ''); } else { - outputPath = resourcePath.replace(root, '').slice(1); + outputPath = resourcePath.replace(root, '').slice(1).replace(relativeTo, ''); } this.cacheable && this.cacheable(); From d212b7bff7ad2dffacc085a86131423ae765dc77 Mon Sep 17 00:00:00 2001 From: Paul Bastowski Date: Tue, 27 Mar 2018 22:29:14 +0200 Subject: [PATCH 2/6] Add description of relativeTo and bump package version --- README.md | 17 ++++++++++++++++- package.json | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a8837df..0cf759c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Angular templatecache webpack loader +> This repo adds the + Puts HTML files to Angular $templateCache. @@ -46,7 +48,20 @@ index.html } ``` -3. You can also use context in webpack to pass correct template url. See [Context example](https://github.com/EJIqpEP/angular-templatecache-loader/tree/master/examples/context) +3. relativeTo - remove a string from the path + +relativeTo is used to strip a matching prefix from the path of the input html file. + +```javascript + { + test: /\.html$/, + loader: "angular-templatecache-loader?relativeTo=/public/" + } +``` + +The above will remove the "/public/" from the generated templateUrl path + +4. You can also use context in webpack to pass correct template url. See [Context example](https://github.com/EJIqpEP/angular-templatecache-loader/tree/master/examples/context) ```javascript var app = path.join(__dirname, 'app'); diff --git a/package.json b/package.json index 2046fc7..fc15c2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "angular-templatecache-loader", - "version": "0.2.0", + "name": "angular-templatecache-loader-2", + "version": "0.3.0", "description": "Webpack angular templateCache loader", "main": "index.js", "scripts": { From 478d1d1fad4411274adf2342968e7910d6f77b69 Mon Sep 17 00:00:00 2001 From: Paul Bastowski Date: Tue, 27 Mar 2018 22:30:53 +0200 Subject: [PATCH 3/6] Bump package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc15c2a..3e01729 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-templatecache-loader-2", - "version": "0.3.0", + "version": "0.3.1", "description": "Webpack angular templateCache loader", "main": "index.js", "scripts": { From c985a5d6d978338fa8feccdbb8aac44095c2f546 Mon Sep 17 00:00:00 2001 From: Paul Bastowski Date: Tue, 27 Mar 2018 22:32:20 +0200 Subject: [PATCH 4/6] Bump package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e01729..fa74aa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-templatecache-loader-2", - "version": "0.3.1", + "version": "0.3.2", "description": "Webpack angular templateCache loader", "main": "index.js", "scripts": { From b51cabac309e7c6f42df7792e65c1a6dbe48da76 Mon Sep 17 00:00:00 2001 From: Paul Bastowski Date: Tue, 27 Mar 2018 22:37:17 +0200 Subject: [PATCH 5/6] Update readme, update package fields and bump package version --- README.md | 2 +- package.json | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0cf759c..c461235 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ relativeTo is used to strip a matching prefix from the path of the input html fi } ``` -The above will remove the "/public/" from the generated templateUrl path +The above will remove the "/public/" from the generated templateUrl path. 4. You can also use context in webpack to pass correct template url. See [Context example](https://github.com/EJIqpEP/angular-templatecache-loader/tree/master/examples/context) diff --git a/package.json b/package.json index fa74aa4..03dc96f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-templatecache-loader-2", - "version": "0.3.2", + "version": "0.3.3", "description": "Webpack angular templateCache loader", "main": "index.js", "scripts": { @@ -14,9 +14,9 @@ "loader" ], "author": { - "name": "Alexander Kochergin", - "email": "ejiqpep@gmail.com", - "url": "https://github.com/EJIqpEP" + "name": "Paul Bastowski", + "email": "pbastowski@gmail.com", + "url": "https://github.com/pbastowski" }, "license": "MIT", "devDependencies": { @@ -33,10 +33,10 @@ }, "repository": { "type": "git", - "url": "https://github.com/EJIqpEP/angular-templatecache-webpack-loader" + "url": "https://github.com/pbastowski/angular-templatecache-webpack-loader" }, "bugs": { - "url": "https://github.com/EJIqpEP/angular-templatecache-webpack-loader/issues" + "url": "https://github.com/pbastowski/angular-templatecache-webpack-loader/issues" }, - "homepage": "https://github.com/EJIqpEP/angular-templatecache-webpack-loader" + "homepage": "https://github.com/pbastowski/angular-templatecache-webpack-loader" } From 50cb0888ddeb2fb81904446b5147f4bce9d1678f Mon Sep 17 00:00:00 2001 From: Paul Bastowski Date: Tue, 27 Mar 2018 22:40:55 +0200 Subject: [PATCH 6/6] Updated package github links --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 03dc96f..005361e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-templatecache-loader-2", - "version": "0.3.3", + "version": "0.3.4", "description": "Webpack angular templateCache loader", "main": "index.js", "scripts": { @@ -33,10 +33,10 @@ }, "repository": { "type": "git", - "url": "https://github.com/pbastowski/angular-templatecache-webpack-loader" + "url": "https://github.com/pbastowski/angular-templatecache-loader" }, "bugs": { - "url": "https://github.com/pbastowski/angular-templatecache-webpack-loader/issues" + "url": "https://github.com/pbastowski/angular-templatecache-loader/issues" }, - "homepage": "https://github.com/pbastowski/angular-templatecache-webpack-loader" + "homepage": "https://github.com/pbastowski/angular-templatecache-loader" }