Skip to content

Commit

Permalink
Merge pull request NationalBankBelgium#394 from christophercr/feature…
Browse files Browse the repository at this point in the history
…/scss-processing

fix(stark-build): include postcss loader+plugins to the Webpack css and scss files processing
  • Loading branch information
christophercr authored Jun 1, 2018
2 parents f9a33f6 + ffd60e7 commit 248374d
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 10 deletions.
48 changes: 45 additions & 3 deletions packages/stark-build/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,28 @@ module.exports = function(options) {
*/
{
test: /\.css$/,
use: ["to-string-loader", "css-loader"],
use: [
"to-string-loader",
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 1 // 1 => postcss-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
}
],
exclude: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot, "styles")]
},

Expand All @@ -217,10 +238,31 @@ module.exports = function(options) {
* Returns compiled css content as string
*
*/
// TODO Check if this loader is needed for Angular Material components
{
test: /\.scss$/,
use: ["to-string-loader", "css-loader", "sass-loader"],
use: [
"to-string-loader",
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 2 // 2 => postcss-loader + sass-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
},
"sass-loader"
],
exclude: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot, "styles")]
},

Expand Down
45 changes: 42 additions & 3 deletions packages/stark-build/config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,25 @@ module.exports = function(env) {
loader: "style-loader",
options: { attrs: { nonce: "cef324d21ec5483c8819cc7a5e33c4a2" } }
},
"css-loader"
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 1 // 1 => postcss-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
}
],
include: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot, "styles")]
},
Expand All @@ -152,8 +170,29 @@ module.exports = function(env) {
{
test: /\.scss$/,
use: [
{ loader: "style-loader", options: { attrs: { nonce: "cef324d21ec5483c8819cc7a5e33c4a2" } } },
"css-loader",
{
loader: "style-loader",
options: { attrs: { nonce: "cef324d21ec5483c8819cc7a5e33c4a2" } }
},
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 2 // 2 => postcss-loader + sass-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
},
"sass-loader"
],
include: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot, "styles")]
Expand Down
47 changes: 45 additions & 2 deletions packages/stark-build/config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,28 @@ module.exports = function() {
*/
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 1 // 1 => postcss-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
}
],
include: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot, "styles")]
},

Expand All @@ -163,7 +184,29 @@ module.exports = function() {
*/
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 2 // 2 => postcss-loader + sass-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
},
"sass-loader"
],
include: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot, "styles")]
},

Expand Down
47 changes: 45 additions & 2 deletions packages/stark-build/config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,28 @@ module.exports = function() {
*/
{
test: /\.css$/,
loader: ["to-string-loader", "css-loader"],
loader: [
"to-string-loader",
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 1 // 1 => postcss-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
}
],
exclude: [helpers.root("src/index.html")]
},

Expand All @@ -123,7 +144,29 @@ module.exports = function() {
*/
{
test: /\.scss$/,
loader: ["raw-loader", "sass-loader"],
loader: [
"raw-loader",
{
loader: "css-loader",
options: {
//modules: true, // to check if needed
//minimize: true,
// even if disabled, sourceMaps gets generated
sourceMap: false, // true
autoprefixer: false,
// see https://github.com/webpack-contrib/css-loader#importloaders)
importLoaders: 2 // 2 => postcss-loader + sass-loader
}
},
{
loader: "postcss-loader",
options: {
sourceMap: true,
plugins: commonData.postcssPlugins
}
},
"sass-loader"
],
exclude: [helpers.root("src/index.html")]
},

Expand Down

0 comments on commit 248374d

Please sign in to comment.