-
Notifications
You must be signed in to change notification settings - Fork 33
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
Nap should support async pre-processor APIs #49
Comments
I just stumbled upon this as well. Looks like Less is actually async preprocessor as well. Speaking of which, the current less preprocessor implementation lacks support for @imports. |
@craigspaeth looking at the source code of nap, it seems that everything has been built around the idea of using synchronous functions:
What would be the easiest way to handle async preprocessors? I am seeing 2 possible ways:
|
After playing around with various ideas and looking into possibilities for option 1, I don't think it's possible. There seems to be no easy way around this. Looks like supporting async preprocessors requires major rewrite of the existing code (including tests). |
Yeah I had feared a large rewrite would be necessary to support async pre-compilers. Sort of a pain, but I think ultimately necessary. My only concerns are that it might complicate the setup or transition of nap, but I will look into it. Thanks for all of your help! |
I was playing around today to see what it would take. Started coming from preprocessors and got as far as preprocessPkg. Then I hit a roadblock. fingerprintForPkg calls preprocessPkg, but the nature of fingerprintForPkg is completelt synchronous and it should stay so. |
It seems to me that there is a design/architectural issue here. As far as I understand, what NAP does is that in development mode, it does not preprocess any files unless they are requested via css(), js() or jst() functions. These functions look for the processed contents in the cache and if not there, will call the preprocessors. This allows assets to be re-processed on each request, if any of the file sin the package have been changed. When it comes to other asset managers that I have tried (for example Asset Rack, which, while powerful, I find is not that easy to set up), it seems that they preprocess and set up the assets on app startup, and some of them watch for file changes in dev mode and then rebuild the assets. To be honest, I like nap's approach more, but due to the async nature of node, it looks like it won't work out. |
Although this issue is a year old, it turns out LESS actually has a |
Sass being one of them
The text was updated successfully, but these errors were encountered: