3

I'm making the move from Coda to PHPStorm. I like it, however I need some help with setting up a custom CSS workflow.

Currently I have a file watcher converting my .scss into .css on every save. However I'm not sure how to go about also getting it to set up auto vendor prefixing and CSS compression. I'd like it to be so that:

  • I save the .scss
  • It writes to the .css
  • The .css gets run through something like -prefix-free
  • The .css then undergoes compression

Can anyone walk me through this?

2 Answers 2

3

The best way would be to create a shell/batch script that would do all required steps (file name it will receive as a parameter) and use that script in File Watcher instead of your current SCSS compiler.

Instead of shell/batch script you can write a grunt (or similar automation tool) task and call it in file watcher.


Another option is to create separate file watchers for each step, place them in correct order (from top to bottom). They will be executed one after another.

Problem is -- the "Immediate file synchronization" option must be checked in each of such file watchers .. otherwise only first one will be fired. Other will be fired as well .. but on second invocation only.

The negative side of that option is that file watcher will be executed within 1 second after you type any character -- it will not wait until you click "Save".

Sign up to request clarification or add additional context in comments.

1 Comment

Hmm I've never created a shell/batch script in OSX, and have no experience in Grunt as of yet. I'll look into this when I get home and report back any findings. Thanks for that.
2

Sass is already pretty good at compression. Just execute your Sass compilation with a --style flag liked compressed. Ex:

sass --watch [your files] --style compressed

If you must handle the prefixing through PHPStorm, you'll need to look into their build tool Phing: http://www.jetbrains.com/phpstorm/webhelp/phing-build-tool-window.html

However, Compass (http://compass-style.org/install/) (a Sass add-on) has a large ecosystem of add-ons, one of which is AutoPrefixer: https://github.com/ai/autoprefixer#compass - a post-processor which adds the vendor-specific prefixes to CSS.

2 Comments

Thanks for that. I'm looking into both answers and hopefully will get somewhere with this.
This means that we can't use AutoPrefixer through a File Watcher in PhpStorm/WebStorm?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.