swelham / gulp-ember-templates Goto Github PK
View Code? Open in Web Editor NEWGulp plugin for compiling emberjs templates
License: MIT License
Gulp plugin for compiling emberjs templates
License: MIT License
This line
https://github.com/swelham/gulp-ember-templates/blob/master/index.js#L33
Should be something like:
var prefix = 'define(["' + 'ember' + '"], function (Ember) { return ';
Edit:
Actually this way multiple templates gets into one file with multiple defines. I had to do something like this to make this work.
var amdModulePrefix = 'define(["ember"], function(Ember) {',
amdModulePostfix = '});';
return gulp.src(['app/client/templates/**/*.hbs'])
.pipe($.emberTemplates({
type: 'browser'
}))
.pipe($.concat('common.js'))
.pipe($.insert.wrap(amdModulePrefix, amdModulePostfix))
.pipe(gulp.dest('public/assets/templates'));
This is due to the eternal backslash hell that is Windows, which is not unlike driving on the left or still use Imperial units, IMHO.
Anyways, this can be easily mitigated by patching the Gulpfile with something like:
var templatesOptions = /^win/.test(process.platform) ? {
name: { replace: /\\/g, with: '/' }
} : {};
But it could help to integrate this check somewhere on the plugin or mention it on the doumentation.
Thanks !
Hi.
I can't figure out how to compile components.
I have this in my gulpfile.js:
gulp.task('templates', function () {
gulp.src(src + "templates/**/*.hbs")
.pipe(emberTemplates({
compiler: require('./bower_components/ember/ember-template-compiler'),
isHTMLBars: true
}))
.pipe(gulp.dest(src + 'assets/js'));
});
I have all my components in templates/components/ but they're compiled as normal templates instead of components.
I'm using the latest version. v0.7.1.
I'm a bit unsure if this plugin does support it, but I believe I saw a recent commit about components.
Anyway, thanks for the plugin.
Is there a use case for substringing the '/' in transformedName on line 61 of index.js?
var transformedName = name.split('/').slice(-1)[0].toString();
I've found this line of code breaks the template path to components, making my Ember application break. When I no longer do the .split, my templates compile correctly.
I'd like to submit a pull request but wanted to double check first if there were use cases that needed the transformedName split by '/' and substringed. Please let me know, thanks!
version 2.2.0 of gulp-handlebars supports using Ember's Handlebars compiler and includes both a simple example and complex example that show how to use it to compile templates for Ember.js.
gulp-ember-handlebars
is being deprecated as a result and it would make sense to do the same here to avoid fragmentation in the community.
@swelham , would you be opposed to deprecating gulp-ember-templates
?
If there is functionality in gulp-ember-templates
you feel that gulp-handlebars
does not offer, please file an issue or submit a PR, but be mindful of the gulp plugin guidelines as gulp-ember-templates
does not adhere to them in its current form. @phated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.