https://github.com/rixo/gulp-angular-relative-template-url
Allows to write angular templateUrl relatives to their source directory in the form `templateUrl: './my-template.html'`
https://github.com/rixo/gulp-angular-relative-template-url
Last synced: 12 months ago
JSON representation
Allows to write angular templateUrl relatives to their source directory in the form `templateUrl: './my-template.html'`
- Host: GitHub
- URL: https://github.com/rixo/gulp-angular-relative-template-url
- Owner: rixo
- License: mit
- Created: 2015-09-11T10:01:30.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-10-30T16:33:39.000Z (over 10 years ago)
- Last Synced: 2025-02-25T09:29:20.230Z (over 1 year ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-angular-relative-template-url
Allows to write angular templateUrl relative to their source directory in
the form `templateUrl: './my-template.html'`.
Development is still in **a very early stage**, it works on the projects where I need it,
but nothing has been consolidated yet...
## Usage with generator-gulp-angular
Works well with [`generator-gulp-angular`](https://github.com/Swiip/generator-gulp-angular),
if you modify the *scripts* task as such:
gulp.task('scripts', function () {
return gulp.src(path.join(conf.paths.src, '/app/**/*.js'))
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
// adds the plugin and a dest for files (this is needed when no
// preprocessors like ES6 or coffee are used with the generator)
.pipe($.angularRelativeTemplateUrl({
prefix: 'app/'
}))
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')))
.pipe(browserSync.reload({ stream: true }))
.pipe($.size())
});
When not using a preprocessor, we also need to rewrite the `listFile()` function in the
`karma.conf.js` file in order to use the generated files instead of the original ones:
function listFiles() {
var wiredepOptions = _.extend({}, conf.wiredep, {
dependencies: true,
devDependencies: true
});
return wiredep(wiredepOptions).js
.concat([
// These lines have been changed for relative-templates, from:
//
// path.join(conf.paths.src, '/app/**/*.module.js'),
// path.join(conf.paths.src, '/app/**/*.js'),
// path.join(conf.paths.src, '/**/*.spec.js'),
// path.join(conf.paths.src, '/**/*.mock.js'),
//
path.join(conf.paths.tmp, '/serve/app/**/*.module.js'),
path.join(conf.paths.tmp, '/serve/app/**/*.js'),
path.join(conf.paths.tmp, '/**/*.spec.js'),
path.join(conf.paths.tmp, '/**/*.mock.js'),
// This was already there
path.join(conf.paths.src, '/**/*.html')
]);
}