├── .npmignore ├── .github └── FUNDING.yml ├── generator.js ├── package.json ├── prompts.js ├── index.js └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: nguyenvanduocit 2 | -------------------------------------------------------------------------------- /generator.js: -------------------------------------------------------------------------------- 1 | module.exports = (api, options, rootOptions) => { 2 | api.extendPackage({ 3 | devDependencies: { 4 | 'style-resources-loader': '^1.4.1' 5 | }, 6 | vue: { 7 | pluginOptions: { 8 | 'style-resources-loader': { 9 | 'preProcessor': options.preProcessor, 10 | 'patterns': [] 11 | } 12 | } 13 | } 14 | }) 15 | api.exitLog(`One more step, add patterns for your resources's files in vue.config.js`, 'done') 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-cli-plugin-style-resources-loader", 3 | "version": "0.1.5", 4 | "description": "vue-cli plugin to add style-resources-loader", 5 | "author": "nguyenvanduocit@gmail.com", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/nguyenvanduocit/vue-cli-plugin-style-resources-loader.git" 10 | }, 11 | "homepage": "https://github.com/nguyenvanduocit/vue-cli-plugin-style-resources-loader/#readme" 12 | } 13 | -------------------------------------------------------------------------------- /prompts.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | type: 'list', 4 | name: 'preProcessor', 5 | message: 'CSS Pre-processor?', 6 | choices: [ 7 | { 8 | name: 'SCSS', 9 | value: 'scss' 10 | }, 11 | { 12 | name: 'SASS', 13 | value: 'sass' 14 | }, 15 | { 16 | name: 'Stylus', 17 | value: 'stylus' 18 | }, 19 | { 20 | name: 'Less', 21 | value: 'less' 22 | } 23 | ] 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = (api, projectOptions) => { 2 | const pluginOptions = projectOptions.pluginOptions['style-resources-loader'] 3 | api.chainWebpack(webpackConfig => { 4 | [ 5 | 'normal', 6 | 'normal-modules', 7 | 'vue', 8 | 'vue-modules' 9 | ].forEach((oneOf) => { 10 | webpackConfig.module.rule(pluginOptions.preProcessor).oneOf(oneOf) 11 | .use('style-resources-loader') 12 | .loader('style-resources-loader') 13 | .options({ 14 | patterns: pluginOptions.patterns 15 | }) 16 | }) 17 | }) 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnguyenvanduocit%2Fvue-cli-plugin-style-resources-loader.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnguyenvanduocit%2Fvue-cli-plugin-style-resources-loader?ref=badge_shield) 3 | [![npm version](https://badge.fury.io/js/vue-cli-plugin-style-resources-loader.svg)](https://badge.fury.io/js/vue-cli-plugin-style-resources-loader) 4 | 5 | 6 | Add style-resources-loader to your project easier. 7 | 8 | # Installation 9 | 10 | ``` 11 | vue add style-resources-loader 12 | ``` 13 | 14 | # Config 15 | 16 | Define your resource's patterns under `pluginOptions` > `style-resources-loader` in file `vue.config.js`. 17 | 18 | | Name | Data type | Description | 19 | |--------------|-----------|----------------------------------------| 20 | | preProcessor | string | One of: sass, scss, stylus, less | 21 | | patterns | string, array | Path to the resources you would like to inject | 22 | 23 | ## patterns 24 | 25 | Please read more at [patterns](https://github.com/yenshih/style-resources-loader#patterns). 26 | 27 | ### Example 28 | 29 | ```js 30 | const path = require('path') 31 | module.exports = { 32 | pluginOptions: { 33 | 'style-resources-loader': { 34 | 'preProcessor': 'stylus', 35 | 'patterns': [ 36 | path.resolve(__dirname, './src/styles/abstracts/*.styl'), 37 | ] 38 | } 39 | } 40 | } 41 | ``` 42 | 43 | 44 | ## License 45 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnguyenvanduocit%2Fvue-cli-plugin-style-resources-loader.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnguyenvanduocit%2Fvue-cli-plugin-style-resources-loader?ref=badge_large) 46 | --------------------------------------------------------------------------------