{"_id":"@agilo/sass-watcher","_rev":"5-d8bdc4d2d460bfd2179401d93b26579b","name":"@agilo/sass-watcher","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@agilo/sass-watcher","version":"1.0.0","keywords":["node","sass","watch","post-process"],"license":"MIT","_id":"@agilo/sass-watcher@1.0.0","maintainers":[{"name":"josipmatichr","email":"josip@agilo.co"},{"name":"anteprimorac","email":"anteprimorachr@gmail.com"},{"name":"alenvuletic","email":"alenvuletic@gmail.com"}],"homepage":"https://github.com/agilo/sass-watcher#readme","bugs":{"url":"https://github.com/agilo/sass-watcher/issues"},"dist":{"shasum":"d29256c25a23da604bd6b2e4f3d1d1ceb9cf7764","tarball":"https://registry.npmjs.org/@agilo/sass-watcher/-/sass-watcher-1.0.0.tgz","fileCount":18,"integrity":"sha512-ceWPkVGw3hkrdTrqve6JzZXL88cv3USwNVGPY912PbEVGzGwpy7Zm44EFRUm3YF7sDgVaL9LxAbIohouSL5SSQ==","signatures":[{"sig":"MEQCIGUiIQ7ITIfgGnYFBs3QjFNDI9bGtHKExefzK3LLSkwRAiA2ENeMl6kk7sznK3KYYjA7aj2uhN7XCRs91beL1xmAmQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":78120},"type":"module","exports":"./lib/watcher.js","gitHead":"d85bfcb06f50c6890aba6282d4c7a2ad4907be57","scripts":{"test":"mocha --exit"},"_npmUser":{"name":"anteprimorac","email":"anteprimorachr@gmail.com"},"repository":{"url":"git+https://github.com/agilo/sass-watcher.git","type":"git"},"_npmVersion":"9.6.7","description":"SCSS watcher with post-processing.","directories":{},"_nodeVersion":"20.3.1","dependencies":{"yargs":"^17.7.2","chokidar":"^3.5.3","sass-graph":"^4.0.1","lodash.difference":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","@types/sass-graph":"^2.1.4","@types/lodash.difference":"^4.5.7"},"_npmOperationalInternal":{"tmp":"tmp/sass-watcher_1.0.0_1688551992860_0.6266707683030326","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@agilo/sass-watcher","version":"1.0.1","keywords":["node","sass","watch","post-process"],"license":"MIT","_id":"@agilo/sass-watcher@1.0.1","maintainers":[{"name":"josipmatichr","email":"josip@agilo.co"},{"name":"anteprimorac","email":"anteprimorachr@gmail.com"},{"name":"alenvuletic","email":"alenvuletic@gmail.com"}],"homepage":"https://github.com/agilo/sass-watcher#readme","bugs":{"url":"https://github.com/agilo/sass-watcher/issues"},"dist":{"shasum":"80cc2c6cf8ea2da5e5a4668ce7e3f8efe43b107c","tarball":"https://registry.npmjs.org/@agilo/sass-watcher/-/sass-watcher-1.0.1.tgz","fileCount":6,"integrity":"sha512-C+mavoNp//Vp6IFb6NjzZkJatSkPWf5R7kx2SqDvYvR8NfkP6cDMWrEgOl2jj+JL2j6DVHWSqpzyick3yMwSxg==","signatures":[{"sig":"MEYCIQCM9XIhZxtnvnCVhlZSqBKcQg+T73SvKgFSDTamOp/1dwIhAPlMeutlY+VBGg9owIByKn5gpRdsUK5cEGFeP2/ZMVDe","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9909},"type":"module","types":"./lib/watcher.d.ts","exports":"./lib/watcher.js","gitHead":"61a8df0a78f3e0044c296d079ad94136b22774df","scripts":{"test":"mocha --exit"},"_npmUser":{"name":"anteprimorac","email":"anteprimorachr@gmail.com"},"repository":{"url":"git+https://github.com/agilo/sass-watcher.git","type":"git"},"_npmVersion":"9.6.7","description":"SCSS watcher with post-processing.","directories":{},"_nodeVersion":"20.3.1","dependencies":{"yargs":"^17.7.2","chokidar":"^3.5.3","sass-graph":"^4.0.1","lodash.difference":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","@types/node":"^16.18.38","@types/sass-graph":"^2.1.4","@types/lodash.difference":"^4.5.7"},"_npmOperationalInternal":{"tmp":"tmp/sass-watcher_1.0.1_1688566466325_0.29419608016671916","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-07-05T10:13:12.812Z","modified":"2026-05-04T12:25:12.174Z","1.0.0":"2023-07-05T10:13:13.054Z","1.0.1":"2023-07-05T14:14:26.489Z"},"bugs":{"url":"https://github.com/agilo/sass-watcher/issues"},"license":"MIT","homepage":"https://github.com/agilo/sass-watcher#readme","keywords":["node","sass","watch","post-process"],"repository":{"url":"git+https://github.com/agilo/sass-watcher.git","type":"git"},"description":"SCSS watcher with post-processing.","maintainers":[{"email":"anteprimorachr@gmail.com","name":"anteprimorac"},{"email":"josip@agilo.co","name":"josipmatichr"}],"readme":"# @agilo/sass-watcher\n\n[![Test](https://github.com/agilo/sass-watcher/actions/workflows/test.yml/badge.svg)](https://github.com/agilo/sass-watcher/actions/workflows/test.yml)\n\nSCSS watcher with post-processing.\n\n## Why?\n\n`sass` has `--watch` option but it doesn't allow post-processing of the compiled CSS.\n\nThe only way is to \"watch\" the generated CSS file with another watcher. **It's not convenient**.\n\n`@agilo/sass-watcher` provides simple way to do SCSS watching with post-processing.\n\n## Install\n\n```sh\nnpm install @agilo/sass-watcher\n```\n\n## Usage: JS\n\nExample: `sass` → `autoprefixer`.\n\n```js\n// watch-it.js\n\nimport fs from 'fs';\nimport * as sass from 'sass';\nimport postcss from 'postcss';\nimport autoprefixer from 'autoprefixer';\nimport Watcher from '@agilo/sass-watcher';\n\n// Input variables\nconst inputFile = process.argv[2];\nconst outputFile = process.argv[3];\nconst supportedBrowsers = process.argv[4];\n\n// Options\nconst watcherOptions = {\n  verbosity: 1,\n}\n\n// Renderer\nfunction render() {\n  console.warn('Rendering \"' + inputFile + '\" file...');\n\n  sass.render({file: inputFile}, function(err, result) {\n    if (err) {\n      console.error('Error: ' + err.message);\n      return;\n    }\n\n    const processor = postcss([\n      autoprefixer({\n        browsers: supportedBrowsers.split(/,\\s*/g)\n      })\n    ]);\n\n    console.warn('Processing with Autoprefixer for browsers: ' + supportedBrowsers);\n\n    processor.process(result.css.toString()).then(\n      function(result) {\n        console.warn('Outputting to \"' + outputFile + '\" file...');\n        fs.writeFile(outputFile, result.css);\n      },\n      function(err) {\n        console.error('Error: ' + err.message);\n      }\n    );\n  });\n}\n\n// Start watching\nconst watcher = new Watcher(inputFile, watcherOptions);\nwatcher.on('init', render);\nwatcher.on('update', render);\nwatcher.run();\n```\n\nRun your custom script:\n\n```sh\nnode watch-it.js src/input.scss dist/output.css \"ie >= 9, > 1%\"\n```\n\n\nAvailable options are a subset of the CLI options:\n\n* `includePaths`\n* `rootDir`\n* `verbosity`\n* `includeExtensions`\n\n## Collaboration\n\nFeel free to create a ticket or a pull-request ;)\n","readmeFilename":"README.md"}