rollup-plugin-scss
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -7,2 +7,6 @@ # Changelog | ||
## [2.2.0] - 2020-04-11 | ||
### Added | ||
- Add `watch` option @JimSchofield | ||
## [2.1.0] - 2019-12-22 | ||
@@ -22,3 +26,4 @@ ### Added | ||
[Unreleased]: https://github.com/thgh/rollup-plugin-scss/compare/v2.1.0...HEAD | ||
[Unreleased]: https://github.com/thgh/rollup-plugin-scss/compare/v2.2.0...HEAD | ||
[2.2.0]: https://github.com/thgh/rollup-plugin-scss/compare/v2.1.0...v2.2.0 | ||
[2.1.0]: https://github.com/thgh/rollup-plugin-scss/compare/v2.0.0...v2.1.0 | ||
@@ -25,0 +30,0 @@ [2.0.0]: https://github.com/thgh/rollup-plugin-scss/compare/v1.0.0...v2.0.0 |
@@ -46,3 +46,3 @@ 'use strict'; | ||
} | ||
if (e.message.includes('node-sass') && e.message.includes('bindigs')) { | ||
if (e.message.includes('node-sass') && e.message.includes('bindings')) { | ||
console.log(green('Solution:\n\t' + 'npm rebuild node-sass --force')); | ||
@@ -56,4 +56,6 @@ } | ||
return { | ||
name: 'css', | ||
name: 'scss', | ||
transform: function transform (code, id) { | ||
var this$1 = this; | ||
if (!filter(id)) { | ||
@@ -63,2 +65,10 @@ return | ||
// Rebuild all scss files if anything happens to this folder | ||
// TODO: check if it's possible to get a list of all dependent scss files | ||
// and only watch those | ||
if ('watch' in options) { | ||
var files = Array.isArray(options.watch) ? options.watch : [options.watch]; | ||
files.forEach(function (file) { return this$1.addWatchFile(file); }); | ||
} | ||
// When output is disabled, the stylesheet is exported as a string | ||
@@ -65,0 +75,0 @@ if (options.output === false) { |
@@ -42,3 +42,3 @@ import { existsSync, mkdirSync, writeFile } from 'fs' | ||
} | ||
if (e.message.includes('node-sass') && e.message.includes('bindigs')) { | ||
if (e.message.includes('node-sass') && e.message.includes('bindings')) { | ||
console.log(green('Solution:\n\t' + 'npm rebuild node-sass --force')) | ||
@@ -52,3 +52,3 @@ } | ||
return { | ||
name: 'css', | ||
name: 'scss', | ||
transform (code, id) { | ||
@@ -59,2 +59,10 @@ if (!filter(id)) { | ||
// Rebuild all scss files if anything happens to this folder | ||
// TODO: check if it's possible to get a list of all dependent scss files | ||
// and only watch those | ||
if ('watch' in options) { | ||
const files = Array.isArray(options.watch) ? options.watch : [options.watch] | ||
files.forEach(file => this.addWatchFile(file)) | ||
} | ||
// When output is disabled, the stylesheet is exported as a string | ||
@@ -61,0 +69,0 @@ if (options.output === false) { |
{ | ||
"name": "rollup-plugin-scss", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Rollup multiple .scss, .sass and .css imports", | ||
@@ -14,2 +14,3 @@ "main": "index.cjs.js", | ||
"test": "cd test && rm -f output.* && rollup -c && cmp output.js expected.js && cmp output.css expected.css && cd ..", | ||
"testw": "cd test && rm -f output.* && rollup -cw; cd ..", | ||
"prepare": "rollup -c" | ||
@@ -42,3 +43,3 @@ }, | ||
"devDependencies": { | ||
"rollup": "1", | ||
"rollup": "2", | ||
"rollup-plugin-buble": "0", | ||
@@ -45,0 +46,0 @@ "standard": "14" |
@@ -36,6 +36,9 @@ # Rollup multiple .scss, .sass and .css imports | ||
export default { | ||
entry: 'entry.js', | ||
dest: 'bundle.js', | ||
input: 'input.js', | ||
output: { | ||
file: 'output.js', | ||
format: 'esm' | ||
}, | ||
plugins: [ | ||
scss() // will output compiled styles to bundle.css | ||
scss() // will output compiled styles to output.css | ||
] | ||
@@ -47,3 +50,3 @@ } | ||
// entry.js | ||
import './reset.css' | ||
import './reset.scss' | ||
``` | ||
@@ -58,3 +61,3 @@ | ||
scss({ | ||
//Choose *one* of these possible "output:..." options | ||
// Choose *one* of these possible "output:..." options | ||
// Default behaviour is to write all styles to the bundle destination where .js is replaced by .css | ||
@@ -80,3 +83,8 @@ output: true, | ||
// Prefix global scss. Useful for variables and mixins. | ||
prefix: `@import "./fonts.scss";` | ||
prefix: `@import "./fonts.scss";`, | ||
// Add file/folder to be monitored in watch mode so that changes to these files will trigger rebuilds. | ||
// Do not choose a directory where rollup output or dest is pointed to as this will cause an infinite loop | ||
watch: 'src/styles/components', | ||
watch: ['src/styles/components', 'src/multiple/folders'], | ||
}) | ||
@@ -83,0 +91,0 @@ ``` |
16111
296
116