-
Notifications
You must be signed in to change notification settings - Fork 94
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
scss compile #21
Comments
Hello @gogs85 Not really sure what error you're experiencing, but unless you're importing .scss in the .js files, you don't have a .scss entry defined. Also, I would recommend putting your changes in |
Add a scss rule to webpack.app.js and install style-loader, css-loader and sass-loader via npm (if not already done). Then add scss to the resolved extensions. const app = {
entry: yourEntryDefinition,
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader'
},
{
loader: 'sass-loader'
}
]
})
}
]
},
// ...
resolve: {
extensions: ['.js', '.tsx', '.ts', '.css', '.scss']
}
}; Not in particular a problem with this patternlab edition. You have all freedom in the webpack.app.js to configure and use webpack the way you need it. |
Ahh, great, thank you very much :) |
@renestalder I've used your example to extend the webpack tasks. But on each .scss file save the mustache files are also getting build. Is this default behaviour, or something wrong with my setup? |
@jeroenkampinga Yes, it's currently the same for me. |
@renestalder Okay, that's too bad. When saving an .scss file the whole task takes around 7-8 seconds to finish. It also looks like the mustache files are processed twice. At least it's shown twice in the output. Is this also the case in your setup? |
@jeroenkampinga Yeah, you're right, seems to run twice or at least logs it like it runs twice. But since I only used that in a small pattern library and it worked, I didn't bother that match. I assume the watcher in the webpack.config.babel.js does a bit more than It should. I don't think that it has something to do with the Scss setup how it is. |
#23 has been opened to address and fix this. |
I found the following issue:
Describe in as much detail as possible the issue you have discovered.
I have problem to use scss in webpack:
// webpack.config.js const webpack = require('webpack'); const {resolve} = require('path'); const globby = require('globby'); const {getIfUtils, removeEmpty} = require('webpack-config-utils'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const EventHooksPlugin = require('event-hooks-webpack-plugin'); const plConfig = require('./patternlab-config.json'); const patternlab = require('patternlab-node')(plConfig); const patternEngines = require('patternlab-node/core/lib/pattern_engines'); const merge = require('webpack-merge'); const customization = require(
${plConfig.paths.source.app}/webpack.app.js`);const ExtractTextPlugin = require('extract-text-webpack-plugin');
const bundleExtractPlugin = new ExtractTextPlugin({
filename: './public/css/bundle.css',
});
module.exports = env => {
const {ifProd, ifDev} = getIfUtils(env);
const config = merge.smartStrategy(plConfig.webpackMerge)({
devtool: ifDev('source-map'),
context: resolve(__dirname, 'source'),
node: {
fs: "empty"
},
entry: {
// Gathers any Source JS files and creates a bundle
//NOTE: This name can be changed, if so, make sure to update _meta/01-foot.mustache
"js/pl-source":
globby.sync([resolve(plConfig.paths.source.js + '**/*.js')]).map(function (filePath) {
return filePath;
})
},
output: {
path: resolve(__dirname, 'public'),
filename: '[name].js'
},
plugins: removeEmpty([
ifDev(
// Live reloading in development only
new webpack.HotModuleReplacementPlugin(),
}, customization(env))
return config
}
`
Recommendations on Solutions:
The text was updated successfully, but these errors were encountered: