Skip to content

Conversation

@inouetakuya
Copy link
Owner

@inouetakuya inouetakuya commented Aug 10, 2018

解決したい問題

src/scss/ ディレクトリに新規の SCSS ファイルを追加したとき、当該ファイルが CSS にコンパイルされない。下記 Issue と同じ問題。

yarn run build:scss:watch を一旦止めて、実行し直せばコンパイルされるが... SCSS を積極的にファイル分割していく開発スタイルではめんどうくさい。

原因

watching newly created files · Issue #1891 · sass/node-sass に書かれているとおり、node-sass の既知の問題。

解決する気はあるらしくてプルリクつくったりしているがうまく行かなくてクローズしてたりする。

どのように解決するか?

ファイル監視の方法を変更する。下記が候補

  • gulp-watch
  • nodemon

シンプルに行くなら nodemon かなあと。

完了条件

  • SCSS ファイルを新規に追加したときに、src/css 内にコンパイルされること
  • SCSS ファイルをリネームしたときに、src/css 内に、リネーム後の CSS ファイルのみが入っていること
  • SCSS ファイルを削除したときに、src/css 内から、対応する CSS が削除されること

ファイッ!

参考

remy/nodemon: Monitor for any changes in your node.js application and automatically restart the server - perfect for development
https://github.com/remy/nodemon

@inouetakuya
Copy link
Owner Author

@ryamakuchi

ひととおりできたので、確認してほしいです。何か分からないことがあったら、なんなりとー

Copy link
Collaborator

@ryamakuchi ryamakuchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おいちゃんのこれを見て、私の方もうまくいきました。
ありがとう!

"scripts": {
"build:scss": "node-sass --recursive src/scss --output src/css",
"build:scss:watch": "yarn run build:scss && yarn run build:scss --watch",
"build:scss": "yarn run clean:css && node-sass --recursive src/scss --output src/css",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良き!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants