-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import custom handlebars template #11
Comments
I updated readme with some instructions on that topic. Is that ok or you want an actual option in config? |
Thanks for the fast reply. i have an handlebar template i constructed my self (few edits to the on in npm lib) i just want to point to it so the loader will use it instead of the one in the npm lib. i could not understand from the readme how to do it. it will be great if you can add this option in the config, but any other solution that can load custom template from a provided path will help me a lot. thanks. |
Yeah my English sucks. And I am not even sure how to explain it in my own language:) //webpack.config.js
var templater = require('spritesheet-templates');
templater.addTemplate('template_name', templateFunction)
//or
var fs = require('fs');
var handlebarsCode = fs.readFileSync('/path/to/template.handlebars');
templater.addHandlebarsTemplate('template_name', handlebarsCode);
...
new SpritesmithPlugin({
target: {
css: [
['/path/to/generated-source-file', {format: 'template_name'}]
]
}
}) I'll add explicit option to config soon. |
thanks a lot. :) it worked, but only when i loaded the master branch (it could not find the template in latest release version). handlebarsCode = fs.readFileSync('/path/mytemplate', 'utf8'); |
@mixtur, your advice is simply wrong, I'm afraid. The version of var templater = require('webpack-spritesmith/node_modules/spritesheet-templates'); It is ugly and hacky, but it will work. |
Not always. With npm 3+ you have more flat directory structure. And It is kinda works. Sometimes. Need more investigation to be sure. Anyway It should be implemented inside webpack-spritesmith, and what I currently adviced is a dirty temporary workaround. I think I'll deal with it in upcoming weekend. |
You're right, I actually was having an issue with the install order. Sorry about that, I'm still getting used to Node 4. |
in 0.2.5 you can define custom template. So what I did via hack above, now can be achieved this way: ...
new SpritesmithPlugin({
...
target: {
css: [
['/path/to/generated-source-file', {format: 'template_name'}]
]
},
customTemplates: {
template_name: templateFunction,
//or
template_name: '/path/to/template.handlebars'
}
}) The hack should still work though. |
Hi,
great loader.
is there an option to add a custom handlebar template to it, similar to the "cssTemplate" var in the sprite-smith grunt plugin.
thanks in advance.
The text was updated successfully, but these errors were encountered: