UNPKG

700 BJavaScriptView Raw
1const HandleCSSLoader = require('webpack-handle-css-loader')
2
3const LANGS = ['css', 'stylus', 'styl', 'sass', 'scss', 'less']
4
5exports.vue = function (options) {
6 const handleLoader = new HandleCSSLoader(options)
7 return handleLoader.vue()
8}
9
10// Generate loaders for standalone style files (outside of .vue)
11exports.standalone = function (config, options) {
12 const handleLoader = new HandleCSSLoader(options)
13 for (const lang of LANGS) {
14 const rule = handleLoader[lang]()
15 const context = config.module
16 .rule(lang)
17 .test(rule.test)
18
19 rule.use.forEach(use => {
20 context
21 .use(use.loader)
22 .loader(use.loader)
23 .options(use.options)
24 })
25 }
26}