You can run an npm (or similar) task in PhpStorm in two ways. Running a watcher from the package.json file Those compilers would not run on the Sass file watcher in PhpStorm. A common example for that is a PostCSS plugin like the Autoprefixer. The seconds reason is the possibility of additional compilation tasks defined in the package.json file. This is the case for Underscores, where the style.scss files it stored in the sass sub folder, but the compiled style.css file is in the root folder. First, those file watchers are not easy to set up, especially when the folder structure is different to the default structure. So why not just use one of the new compilers in combination with a PhpStorm file watcher? There are two reasons. I’ve tried out Dart Sass, as it was the only compiler that was producing the exact same CSS files on Windows, Linux and Mac in my tests. Now it’s recommended to use either Dart Sass or Lib Sass to compile your files. In the past a Ruby compiler was the recommended option, but as of March 2019, this option has been depecated. But if you develop something that has a compilation task defined in the projects, things can get more complicated, especially when you work in a team with members of that team using different operation systems and default Sass compilers. This is a good way when you don’t have any other mechanism to compile those files bundled with the software/theme/plugin. In a blog post from January 2018, I’ve explained how to set such a file watcher up to compile Sass files. In the past I have usually used the file watchers from PhpStorm. But one of the files that is included for quite some time is the package.json file, defining various npm tasks, of which some are responsible to compile Sass files or watch for file changes on those files. When I inspected the files, I could see some new files in the directory. I always use the “sassified” version and create it with the WP-CLI scaffold command. Last week I started with a new project and developed a theme using Underscores as the base theme.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |