-
Notifications
You must be signed in to change notification settings - Fork 121
Adding CSS stylesheets
Seb edited this page Jan 30, 2015
·
1 revision
It is recommended to use parcelify
as this allows a CSS dependency (as you no it from browserify).
- Add your CSS files to the
style
field
(package.json)
"style" : "css/*.css"
or
"style" : "*.scss"
Important: the registry now only picks the style
dependencies - it doesn't merge it with your css files in the sniper section. So be sure that you add all css files - the "style" attribute can also be an array.
- Adding a build tasks and updating the sniper
2.1) Install parcelify
npm install parcelify --save-dev
2.2) Adding it as a build task
(package.json)
"scripts": {
...
"css": "parcelify ./ -c build/bundle.css",
...
}
2.3) Update the sniper
css: ["/build/bundle.css"]
2.4) Optional: Parcelify has a watch mode
parcelify ./ -w -c build/bundle.css
- Using a preprocessor (SASS, LESS, ...)
-> you need to a parcelify transform
"transforms" : [ "sass-css-stream" ],
"dependencies" : {
"sass-css-stream": "~0.0.1"
}