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

Grunt and Async Writing #100

Open
jlbrooks opened this issue Jun 3, 2016 · 0 comments
Open

Grunt and Async Writing #100

jlbrooks opened this issue Jun 3, 2016 · 0 comments

Comments

@jlbrooks
Copy link

jlbrooks commented Jun 3, 2016

When attempting to run css-modulesify as a browserify transform through Grunt using Grunt-browserify, an output file is generated but there is nothing written to it.

Digging into the code, I believe the issue is with the final asynchronous write here. As noted in the Grunt docs, Grunt is synchronous by default and requires you to register an async task and notify when finished. I have confirmed that changing the async write to be fs.writeFileSync(cssOutFilename, css); solves the issue.

Because this is embedded as a plugin within browserify, which is then run through the grunt-browserify plugin, I don't see an easy way to configure this correctly. Has anyone else been able to get this plugin working with a Grunt build? I'm fairly inexperienced with Grunt, so I could definitely be missing something obvious.

I've put together an example repo here. Running grunt browserify should generate the empty css file.

As far as solutions go, possibly a flag to force a synchronous write? That is, if there isn't something else I'm missing.

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

1 participant