diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..953aa45 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: "22:00" + open-pull-requests-limit: 10 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..999647d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Aslam H + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 419cdea..e263745 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,29 @@ -# Laravel Mix Vue Css Modules +

+ Working with vue & css module is USELESS at least for me, please don't use css module it's only wasting your time!. +

+

+ Laravel Mix Vue Css Modules +
+ npm npm +

Add support for css module laravel mix. ## Installation ``` -npm i laravel-mix-vue-css-modules +npm i laravel-mix-vue-css-modules --save-dev ``` +## Recommended v3 + +[Example](https://github.com/Aslam97/laravel-mix-vue-css-modules/tree/v3#example) + +|Laravel Mix|Laravel Mix Vue CSS Modules|Pre-Processor|Install command| +|---|---|---|---| +|v5|v2|SCSS|`npm install laravel-mix-vue-css-modules@2`| +|v5|[v3](https://github.com/Aslam97/laravel-mix-vue-css-modules/tree/v3)|SCSS, LESS, STYLUS|`npm install laravel-mix-vue-css-modules@3`| + ## Usage First, VueCssModules must be enabled. Your `webpack.mix.js` could look like this: @@ -52,7 +68,7 @@ mix.vueCssModules({ oneOf: true }); #### Pre-Processors -CSS Modules can be used along with other pre-processors. for now only **SCSS** and by default pre-processor is enable. to disable it set `preProcessor` to `false` +CSS Modules can be used along with other pre-processors. default pre-processor is enable. to disable it set `preProcessor` to `false` ```js mix.vueCssModules({ preProcessor: false }); @@ -62,8 +78,8 @@ mix.vueCssModules({ preProcessor: false }); Default: -- use `'[path][name]__[local]` for development -- use `'[hash:base64]'` for production +- `[path][name]__[local]` for development +- `[hash:base64]` for production ```js mix.vueCssModules({ diff --git a/index.js b/index.js index ee5e4b2..0ef818f 100644 --- a/index.js +++ b/index.js @@ -16,9 +16,10 @@ class VueCssModules { sourceMap: false, // {Boolean} importLoaders: 1, // {Number} // webpackDefault: 0 // laravel-mix default: 1 esModule: true, // {Boolean}, - localIdentName: options.cssLoaderOptions.localIdentName - ? options.cssLoaderOptions.localIdentName - : this.defaultLocalIdentName(options.localIdentNameType), // {String} + localIdentName: + options.cssLoaderOptions && options.cssLoaderOptions.localIdentName + ? options.cssLoaderOptions.localIdentName + : this.defaultLocalIdentName(options.localIdentNameType), // {String} }; const cssLoaderOptions = { @@ -37,8 +38,6 @@ class VueCssModules { }, options ); - - console.log(this.options); } /** @@ -119,7 +118,7 @@ class VueCssModules { ], }, { - use: ["style-loader", postCssLoader], + use: ["style-loader", "css-loader", postCssLoader], }, ]; @@ -179,6 +178,8 @@ class VueCssModules { loader: "css-loader", options: this.options.cssLoaderOptions, }, + postCssLoader, + sassLoader, ], }, { diff --git a/package.json b/package.json index e7a497e..5d843b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "laravel-mix-vue-css-modules", - "version": "2.0.0", + "version": "2.1.3", "description": "A Laravel Mix extension for css modules support.", "main": "index.js", "scripts": { @@ -13,6 +13,7 @@ "keywords": [ "laravel", "laravel-mix", + "css-modules", "mix", "webpack", "vue-css-modules",