Skip to content

Commit

Permalink
Add all imported SASS files to the "watch" list
Browse files Browse the repository at this point in the history
* After every file render, grab all the includedFiles and add them all to the rollup watch list.
  • Loading branch information
xenobytezero committed Jul 13, 2022
1 parent 4d2037a commit 67775ee
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/index.ts
Expand Up @@ -174,10 +174,16 @@ export = function plugin(options = {} as RollupPluginSassOptions): RollupPlugin
.then(res => processRenderResponse(pluginOptions, filePath, pluginState, res.css.toString().trim())
.then(result => [res, result])
)
.then(([res, codeResult]) => ({
code: codeResult,
map: {mappings: res.map ? res.map.toString() : ''},
})); // @note do not `catch` here - let error propagate to rollup level.
.then(([res, codeResult]) => {

res.stats.includedFiles.forEach(i => {this.addWatchFile(i)})

return {
code: codeResult,
map: {mappings: res.map ? res.map.toString() : ''}
}

}); // @note do not `catch` here - let error propagate to rollup level.
},

generateBundle(generateOptions: { file?: string },
Expand Down

0 comments on commit 67775ee

Please sign in to comment.