Extract SCSS
See original GitHub issueHi,
I know that we can use the ExtractTextPlugin
to extract the CSS to a different file,
however, would there be anyway to extract the uncompiled SCSS to another file?
I am using SCSS variables to change the theme in my application, and having to compile with webpack takes much longer than a simple SASS compilation would, so I was wondering if there would be a way to simply extract it.
Thanks.
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
scss-extract-loader - npm
Webpack loader for scss-extract. Extract structured variables when importing sass files.. Latest version: 0.0.1, last published: 2 years ago ...
Read more >Extract structured variables from sass files - GitHub
Each variable extracted is available under its context by a key which is the variable name as specified in the sass file. //...
Read more >SCSS - Extract common modules to a seperated files
SCSS - Extract common modules to a seperated files ... common.scss - contains styles for the layout (header, footer, etc...).
Read more >extract-scss-variables - npm Package Health Analysis - Snyk
extract -scss-variables. v0.2.1. Extract variables from SCSS files For more information about how to use this package see README.
Read more >MiniCssExtractPlugin - webpack
It's recommended to combine mini-css-extract-plugin with the css-loader ... style.scss"; let theme = "light"; const themes = {}; themes[theme] = document.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Heyhey I know this is old-ish, but I was just playing with this recently, thought I should chime in, to help anyone else that runs into this issue.
I ran into this problem while making a library, where I wanted a user to be able to import either the .css file OR the .scss file (in case the user wants to use my mixins, etc). So I think what @tuvistavie was looking to do is have a resulting .js file, .css file, and .scss file as his output.
I think @tuvistavie is just using the wrong tool for the job. What he really wants is something that will just follow the imports and append everything together without touching anything else. I use postcss and postcss-loader with the postcss-scss plugin, so that it can handle the scss. I then extract this separately with multi-loader. This has all my sass variables and things intact.
I didn’t really want to build a loader, and I stumbled upon this slightly hacky solution, so I’m just using that (or look at the full code here):
Example:
Dependencies:
I guess it seems like a lot of things to get this to work, but I was already using postcss, so worked for me. Hope it helps! And yey sass-loader. ❤️
@ivebencrazy That’s exactly what I was looking for, thanks! 😄