mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
build.styleResourcesLoader
https://github.com/yenshih/style-resources-loader
This commit is contained in:
parent
a315b71ea8
commit
9fb2fdf4f5
3
examples/style-resources/README.md
Normal file
3
examples/style-resources/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Using build.styleResources with Nuxt.js
|
||||||
|
|
||||||
|
https://nuxtjs.org/examples
|
1
examples/style-resources/assets/resources.scss
Normal file
1
examples/style-resources/assets/resources.scss
Normal file
@ -0,0 +1 @@
|
|||||||
|
$main: #ccc;
|
9
examples/style-resources/nuxt.config.js
Normal file
9
examples/style-resources/nuxt.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
build: {
|
||||||
|
styleResources: {
|
||||||
|
patterns: [
|
||||||
|
'./assets/resources.scss'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
examples/style-resources/package.json
Normal file
11
examples/style-resources/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "hello-nuxt",
|
||||||
|
"dependencies": {
|
||||||
|
"nuxt": "latest"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "nuxt",
|
||||||
|
"build": "nuxt build",
|
||||||
|
"start": "nuxt start"
|
||||||
|
}
|
||||||
|
}
|
12
examples/style-resources/pages/index.vue
Executable file
12
examples/style-resources/pages/index.vue
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
<style lang="scss">
|
||||||
|
.main {
|
||||||
|
background: $main;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="main">
|
||||||
|
<h1>Welcome!</h1>
|
||||||
|
<nuxt-link to="/about">About page</nuxt-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -56,10 +56,20 @@ export default function styleLoader(ext, loaders = [], isVueLoader = false) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/yenshih/style-resources-loader
|
||||||
|
let styleResourcesLoader
|
||||||
|
if (this.options.build.styleResources) {
|
||||||
|
styleResourcesLoader = {
|
||||||
|
loader: 'style-resources-loader',
|
||||||
|
options: this.options.build.styleResources
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
vueStyleLoader,
|
vueStyleLoader,
|
||||||
cssLoader,
|
cssLoader,
|
||||||
postcssLoader,
|
postcssLoader,
|
||||||
...loaders
|
...loaders,
|
||||||
|
styleResourcesLoader
|
||||||
].filter(l => l)
|
].filter(l => l)
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,7 @@
|
|||||||
"server-destroy": "^1.0.1",
|
"server-destroy": "^1.0.1",
|
||||||
"source-map": "^0.6.1",
|
"source-map": "^0.6.1",
|
||||||
"source-map-support": "^0.5.0",
|
"source-map-support": "^0.5.0",
|
||||||
|
"style-resources-loader": "^0.3.0",
|
||||||
"uglifyjs-webpack-plugin": "^1.0.1",
|
"uglifyjs-webpack-plugin": "^1.0.1",
|
||||||
"url-loader": "^0.6.2",
|
"url-loader": "^0.6.2",
|
||||||
"vue": "^2.5.6",
|
"vue": "^2.5.6",
|
||||||
|
Loading…
Reference in New Issue
Block a user