-
Notifications
You must be signed in to change notification settings - Fork 6
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
request: import once functionality #10
Comments
I'll be releasing this soon! Here's a proof of concept: https://github.com/davidkpiano/sassport/blob/master/src/modules/once.js You can actually straight up use this module right now: var importOnce = require('sassport/lib/modules/once');
//...
sassport([ importOnce ]).render(...); Then in your SCSS: @import 'some-partial !once';
// ... |
Is it possible to define I mean do something like @import 'some-partial !once !reference'; Sorry for the barrage of questions |
It's definitely possible to use multiple loaders, and they will run left to right: https://github.com/davidkpiano/sassport/blob/master/test/loaders.js#L52 So your example will work, and it will first run it through I can definitely see having a sassport([ once, reference ], {
defaultLoaders: ['once']
}).render(...); |
Looks really good. |
I assume the import-once functionality is not yet available in the version that's NPM, right? |
It actually is available, just not documented: https://github.com/davidkpiano/sassport/blob/master/test/loaders.js#L86 But I will be making a separate package for this module, most likely called |
Would this work with sub-dependencies? I think this would be the most interesting use case, as it would enable efficient modules. The scenario is in mind is this: // _module-a.scss
@import `node_modules/module-b`;
// styles.scss
@import `node_modules/module-a`;
@import `node_modules/module-b`; ideally, an |
Yes, it will. In Sass, importing is a blocking synchronous action, meaning that this sequence of imports will happen:
|
👍 |
An import-once functionality in the default, reference and dynamic loaders would be really nice.
See node-sass-import-once and eyeglass's import-once
The text was updated successfully, but these errors were encountered: