Skip to content

Commit

Permalink
update docs for global scss loading
Browse files Browse the repository at this point in the history
per this comment thread: vuejs#328 (comment)
  • Loading branch information
westwick committed Jun 28, 2017
1 parent e2d998a commit 7aa27c0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/en/configurations/pre-processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ Contrary to what its name indicates, [*sass*-loader](https://github.com/jtangeld

See the [Advanced Loader Configuration](./advanced.md) Section for further information about how to configure vue-loader.

#### Loading a global settings file

A common request is to be able to load a settings file in each component without the need to explicity import it each time, e.g. to use scss variables globally throughout all components. To accomplish this:

``` bash
npm install sass-resources-loader --save-dev
```

Then update your `build/utils.js` file:

``` js
scss: generateLoaders('sass').concat(
{
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, '../src/style/_variables.scss')
}
}
),
```

It is recommended to only include variables, mixins, etc. in this file, to prevent duplicated css in your final, compiled files.

### JavaScript

All JavaScript inside Vue components are processed by `babel-loader` by default. But you can of course change it:
Expand Down

0 comments on commit 7aa27c0

Please sign in to comment.