Skip to content
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

Fails to render custom template... template file name is contents of output stylesheet #69

Open
knightcode opened this issue Sep 26, 2017 · 4 comments

Comments

@knightcode
Copy link

For each template type, lib/stylesheet/index.js calls getTemplatedStylesheet once passing in the contents of a file for the respective built in template, and getTemplatedStylesheet then returns a function that is used as renderStylesheet in nsg.js.

However, when using a custom template file,getTemplatedStylesheet is passed the filename instead of the contents of the file.

@selaux
Copy link
Owner

selaux commented Sep 27, 2017

That was an intentional change on the current master here, which is not yet documented properly. Basically the new version will require you to pass the contents of a custom template file instead of the path. Does it work when you read the file contents with fs.readFileSync?

@knightcode
Copy link
Author

eh. I don't really like the idea of including the template in Gruntfile.js. It's seems cleaner to have it separated off in its own file with which I can do a git diff independently of other code. Gruntfile is configuration.

It also seems harder to include a custom template if you ever provide a CLI.

@selaux
Copy link
Owner

selaux commented Sep 27, 2017

You dont have to have it in your gruntfile, you just need to read it there. And for the CLI some code would be needed anyways so than can include reading custom templates. Of course it is one more line in your gruntfile but it makes the sprite generator much more versatile. The whole code can be executed independent of the javascript runtime that is used, e.g. in the browser. See #67.

@knightcode
Copy link
Author

I can't really imagine the app that would inflict that work on it's user, but I get what you're going for.

It still seems like you could load the 'fs' dependency only if the config calls for it and not obliterate your legacy users like me. But I don't keep grunt running in production, so my template will only waste memory on my MacBook while 'grunt watch' is running. I guess I can deal with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants