diff --git a/package.json b/package.json index 749562e..399f103 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup-plugin-less", - "version": "0.1.0", + "version": "0.2.0", "description": "a rollup plugin for less files", "main": "dist/rollup-plugin-less.js", "jsnext:main": "dist/rollup-plugin-less.mjs", diff --git a/src/index.js b/src/index.js index 11d5672..383504c 100644 --- a/src/index.js +++ b/src/index.js @@ -18,11 +18,17 @@ let fileCount = 0; export default function plugin (options = {}) { options.insert = options.insert || false; + options.watch = options.watch || false; const filter = createFilter(options.include || [ '**/*.less', '**/*.css' ], options.exclude || 'node_modules/**'); const injectFnName = '__$styleInject' return { name: 'less', + load() { + if (options.watch){ + fileCount = 0; + } + }, intro() { return options.insert ? insertStyle.toString().replace(/insertStyle/, injectFnName) : ''; },