Skip to content

yiwuyu/vue-cli-plugin-style-resources-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

FOSSA Status npm version

Add style-resources-loader to your project easier.

Installation

vue add style-resources-loader

Config

Define your resource's patterns under pluginOptions > style-resources-loader in file vue.config.js.

Name Data type Description
preProcessor {string} One of: sass, scss, stylus, less
patterns {string string[]}
injector {Function 'prepend'

patterns

Please read more at patterns.

Example

const path = require('path')
module.exports = {
  pluginOptions: {
    'style-resources-loader': {
      'preProcessor': 'stylus',
      'patterns': [
        path.resolve(__dirname, './src/styles/abstracts/*.styl'),
      ],
      'injector': 'append'
    }
  }
}
const path = require('path')
module.exports = {
  pluginOptions: {
    'style-resources-loader': {
      'preProcessor': 'stylus',
      'patterns': [
        path.resolve(__dirname, 'path/to/stylus/variables/*.styl'),
        path.resolve(__dirname, 'path/to/stylus/mixins/*.styl')
      ],
      'injector': (source, resources) => {
        const combineAll = type => resources
            .filter(({ file }) => file.includes(type))
            .map(({ content }) => content)
            .join('');

        return combineAll('variables') + combineAll('mixins') + source;
    }
    }
  }
}

License

FOSSA Status

About

Vue cli plugin to support style-resources-loader.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%