phoenix-frameworkbrunchsass-brunch

sass-brunch omits modified SCSS on live-reload


On my Phoenix project, I found a peculiar behavior of sass-brunch.

Here are the short descriptions of my problem:

On the log file, I noticed an entry that may be related to this issue:

[debug] Duplicate channel join for topic "phoenix:live_reload" in Phoenix.LiveReloader.Socket. Closing existing channel for new join.

I don't see such a line on my Mac.

My environment:

My package.json:

{ "repository": {}, "license": "MIT", "scripts": { "deploy": "brunch build --production", "watch": "brunch watch --stdin" }, "dependencies": { "phoenix": "file:deps/phoenix", "phoenix_html": "file:deps/phoenix_html" }, "devDependencies": { "babel-brunch": "6.0.6", "brunch": "2.10.7", "clean-css-brunch": "2.10.0", "sass-brunch": "^2.10.4", "uglify-js-brunch": "2.1.1" } }

[UPDATE]

I found an interesting fact.


Solution

  • I found a workaround to my problem.

    Put these lines to the brunch-config.js:

    watcher: { usePolling: true }

    As the documentation of Brunch says, watcher gets slower but can be more reliable by setting true to this option.

    The usePolling option is passed to chokidar, whose document says:

    usePolling (default: false). Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU utilization, consider setting this to false. It is typically necessary to set this to true to successfully watch files over a network, and it may be necessary to successfully watch files in other non-standard situations.