Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
fix: update the css loader in order to fix a bug with leading dashes …
Browse files Browse the repository at this point in the history
…of css classes (#847)
  • Loading branch information
Dimitar Tachev authored Apr 4, 2019
1 parent dc6210d commit 7670e33
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 105 deletions.
4 changes: 2 additions & 2 deletions demo/AngularApp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ module.exports = env => {
test: /[\/|\\]app\.css$/,
use: [
"nativescript-dev-webpack/style-hot-loader",
{ loader: "css-loader", options: { minimize: false, url: false } }
{ loader: "css-loader", options: { url: false } }
]
},
{
test: /[\/|\\]app\.scss$/,
use: [
"nativescript-dev-webpack/style-hot-loader",
{ loader: "css-loader", options: { minimize: false, url: false } },
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
Expand Down
24 changes: 12 additions & 12 deletions demo/JavaScriptApp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = env => {
"__dirname": false,
},
devtool: sourceMap ? "inline-source-map" : "none",
optimization: {
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
Expand All @@ -111,7 +111,7 @@ module.exports = env => {
test: (module, chunks) => {
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) ||
appComponents.some(comp => comp === moduleName);
appComponents.some(comp => comp === moduleName);

},
enforce: true,
Expand Down Expand Up @@ -172,17 +172,17 @@ module.exports = env => {
use: "nativescript-dev-webpack/markup-hot-loader"
},

{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },

{
test: /\.css$/,
use: { loader: "css-loader", options: { minimize: false, url: false } }
use: { loader: "css-loader", options: { url: false } }
},

{
test: /\.scss$/,
use: [
{ loader: "css-loader", options: { minimize: false, url: false } },
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
Expand All @@ -195,14 +195,14 @@ module.exports = env => {
"process": undefined,
}),
// Remove all files from the out dir.
new CleanWebpackPlugin([ `${dist}/**/*` ]),
// Copy native app resources to out dir.
new CleanWebpackPlugin([`${dist}/**/*`]),
// Copy native app resources to out dir.
new CopyWebpackPlugin([
{
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
context: projectRoot
},
{
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
context: projectRoot
},
]),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
Expand Down
22 changes: 11 additions & 11 deletions demo/TypeScriptApp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = env => {
"__dirname": false,
},
devtool: sourceMap ? "inline-source-map" : "none",
optimization: {
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
Expand All @@ -113,7 +113,7 @@ module.exports = env => {
test: (module, chunks) => {
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) ||
appComponents.some(comp => comp === moduleName);
appComponents.some(comp => comp === moduleName);

},
enforce: true,
Expand Down Expand Up @@ -174,17 +174,17 @@ module.exports = env => {
use: "nativescript-dev-webpack/markup-hot-loader"
},

{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },

{
test: /\.css$/,
use: { loader: "css-loader", options: { minimize: false, url: false } }
use: { loader: "css-loader", options: { url: false } }
},

{
test: /\.scss$/,
use: [
{ loader: "css-loader", options: { minimize: false, url: false } },
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
Expand All @@ -209,14 +209,14 @@ module.exports = env => {
"process": undefined,
}),
// Remove all files from the out dir.
new CleanWebpackPlugin([ `${dist}/**/*` ]),
new CleanWebpackPlugin([`${dist}/**/*`]),
// Copy native app resources to out dir.
new CopyWebpackPlugin([
{
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
context: projectRoot
},
{
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
context: projectRoot
},
]),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@angular-devkit/core": "~7.2.0",
"clean-webpack-plugin": "~1.0.0",
"copy-webpack-plugin": "~4.6.0",
"css-loader": "~1.0.0",
"css-loader": "~2.1.1",
"global-modules-path": "2.0.0",
"minimatch": "3.0.4",
"nativescript-hook": "0.2.4",
Expand Down
4 changes: 2 additions & 2 deletions templates/webpack.angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ module.exports = env => {
test: /[\/|\\]app\.css$/,
use: [
"nativescript-dev-webpack/style-hot-loader",
{ loader: "css-loader", options: { minimize: false, url: false } }
{ loader: "css-loader", options: { url: false } }
]
},
{
test: /[\/|\\]app\.scss$/,
use: [
"nativescript-dev-webpack/style-hot-loader",
{ loader: "css-loader", options: { minimize: false, url: false } },
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
Expand Down
20 changes: 10 additions & 10 deletions templates/webpack.javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const hashSalt = Date.now().toString();
const hashSalt = Date.now().toString();

module.exports = env => {
// Add your custom Activities, Services and other android app components here.
Expand Down Expand Up @@ -113,7 +113,7 @@ module.exports = env => {
test: (module, chunks) => {
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) ||
appComponents.some(comp => comp === moduleName);
appComponents.some(comp => comp === moduleName);

},
enforce: true,
Expand Down Expand Up @@ -177,17 +177,17 @@ module.exports = env => {
use: "nativescript-dev-webpack/markup-hot-loader"
},

{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },

{
test: /\.css$/,
use: { loader: "css-loader", options: { minimize: false, url: false } }
use: { loader: "css-loader", options: { url: false } }
},

{
test: /\.scss$/,
use: [
{ loader: "css-loader", options: { minimize: false, url: false } },
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
Expand All @@ -200,7 +200,7 @@ module.exports = env => {
"process": undefined,
}),
// Remove all files from the out dir.
new CleanWebpackPlugin([ `${dist}/**/*` ]),
new CleanWebpackPlugin([`${dist}/**/*`]),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: { glob: "fonts/**" } },
Expand All @@ -213,10 +213,10 @@ module.exports = env => {
// configures the WebPack runtime to be generated inside the snapshot
// module and no `runtime.js` module exist.
(snapshot ? [] : ["./runtime"])
.concat([
"./vendor",
"./bundle",
])
.concat([
"./vendor",
"./bundle",
])
),
// For instructions on how to set up workers with webpack
// check out https://github.com/nativescript/worker-loader
Expand Down
20 changes: 10 additions & 10 deletions templates/webpack.typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const hashSalt = Date.now().toString();
const hashSalt = Date.now().toString();

module.exports = env => {
// Add your custom Activities, Services and other Android app components here.
Expand Down Expand Up @@ -115,7 +115,7 @@ module.exports = env => {
test: (module, chunks) => {
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) ||
appComponents.some(comp => comp === moduleName);
appComponents.some(comp => comp === moduleName);

},
enforce: true,
Expand Down Expand Up @@ -179,17 +179,17 @@ module.exports = env => {
use: "nativescript-dev-webpack/markup-hot-loader"
},

{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },

{
test: /\.css$/,
use: { loader: "css-loader", options: { minimize: false, url: false } }
use: { loader: "css-loader", options: { url: false } }
},

{
test: /\.scss$/,
use: [
{ loader: "css-loader", options: { minimize: false, url: false } },
{ loader: "css-loader", options: { url: false } },
"sass-loader"
]
},
Expand All @@ -213,7 +213,7 @@ module.exports = env => {
"process": undefined,
}),
// Remove all files from the out dir.
new CleanWebpackPlugin([ `${dist}/**/*` ]),
new CleanWebpackPlugin([`${dist}/**/*`]),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: { glob: "fonts/**" } },
Expand All @@ -226,10 +226,10 @@ module.exports = env => {
// configures the WebPack runtime to be generated inside the snapshot
// module and no `runtime.js` module exist.
(snapshot ? [] : ["./runtime"])
.concat([
"./vendor",
"./bundle",
])
.concat([
"./vendor",
"./bundle",
])
),
// For instructions on how to set up workers with webpack
// check out https://github.com/nativescript/worker-loader
Expand Down
Loading

0 comments on commit 7670e33

Please sign in to comment.