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

Vue cli plugin to support style-resources-loader.
58 stars 7 forks source link

No loading global styles unless I declare in component #13

Closed mituller closed 5 years ago

mituller commented 5 years ago

This seems to be strange behavior to me. I have loaded the plugin, and in my vue.config I have the following:

const path = require("path");

module.exports = {
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'scss',
      patterns: [path.resolve(__dirname, "./src/styles/init.scss")]
    }
  }
};

This seems to be something with the way Vue renders and processes the styles. So I have added a style setting

* {
}

in the App.vue file so that styles are loaded on each page. I assumed this would do this by default with the loader.

Is there a better way?

nguyenvanduocit commented 5 years ago

Actually, The plugin will concats the file that matches your pattern to any SCSS script that needs to progress by webpack. So, your patterns should only contain variables, mixin. For global style, I think you should import it directly in App.vue