2

I'm currently using YUI Compressor to compress my CSS files in a project which worked fine but because of multiple files for plugins I decided to use subfolders in my CSS folder. How can I make the File Watcher also work on subfolders? I can't seem to find any documentation on this, nor have I found anyone with the same problem on the web.

I don't mind if all CSS files throughout the whole project scope gets minified, but I want to avoid defining new File Watcher every time I create a new subfolder.


PS: I see a checked "Track only root files" option in the Edit Watcher screen, but it's greyed out, so I can't turn it off. Don't know why this option is provided, since it always seems to be greyed out, no matter what settings I try.

wittich
  • 2,079
  • 2
  • 27
  • 50
Jeroen
  • 343
  • 1
  • 2
  • 12

3 Answers3

0

Not sure i understand what subfolders are meant. With default scope (Project Files) all .css files in the project (root folder with all subfolders, recursively) are watched - why do you need to create a new watcher when adding a folder? Do you use some custom scopes in your watcher(s)?

lena
  • 90,154
  • 11
  • 145
  • 150
  • No i'm not using any custom scope, just the default. I would like to make the filewatcher work on the entire project but the "Track only root files" option is on and disabled for unchecking (greyed out) in any scope or setting i try. I think this is my problem but i cant seem to find any reason or awnser to make this option optional. The irony... – Jeroen Oct 16 '14 at 13:39
  • 1
    'Track only root files' option has no relation to watchers scope (and it does nothing in case if the YUI Compressor is used) - with scope set to 'Project Files' all files of the chosen type are watched. Do you mean that not all .css files in your project are processed? – lena Oct 16 '14 at 14:44
  • Thanks Lena, you made me look deeper into the scope option and made me find my problem indirectly:) how can i 1UP your help on this site without marking awnser? – Jeroen Oct 16 '14 at 15:24
0

Found it!

The "Track only root files" option not being optional was not the (or atleast not the whole) problem. This was bypassable by not using the default YUI Compressor file watcher template but creating a custom one.

The real problem was that my scope was set to Project files (the Root of the project) but the Arguments string being set to $FilePath$.css -o $FilePathWithoutAllExtensions$.min.css. What this means is that The watcher was searching for C:/[PROJECTPATH]/[SUBFOLDERS]/[FILENAME].css in the Project root, and then outputting it into the Root of the project (-o $FileNameWithoutExtension$.min.css).

With some fiddling with the Arguments and the Insert Macro's function i made this new Arguments string: $FileDirRelativeToProjectRoot$\$FileNameWithoutAllExtensions$.css -o $FileDirRelativeToProjectRoot$\$FileNameWithoutAllExtensions$.min.css. It now watches all [FILENAME].css files and places the minified versions in the same folder of the original.

Using the Show console: Always instead of Show console: Error option really helped me figuring out this problem since not finding a file to minify, based on the arguments, apparently is "not an error".

Hope this explanation will help to safe some frustration and hours for everyone who encounters this problem.

Jeroen
  • 343
  • 1
  • 2
  • 12
0

I struggle a while with this also due to the fact that you always have to apply settings, make some change on the SCSS File and see if it's working.

My setup is working find now for a following structure:

// Source
./scss/
    - styles.scss
    - _variables.scss
    - subfolder/
      - more-styles.scss

// Output
./css
    - styles.css
    - subfolder/
      - more-styles.css

My File Watcher Settings look like that:

// Program: 
sass

// Arguments: 
./$FileDirPathFromParent(scss)$$FileName$:../css/$FileDirPathFromParent(scss)$$FileNameWithoutExtension$.css

// Output paths to refresh: 
$FileNameWithoutExtension$.css:$FileNameWithoutExtension$.css.map

// Working directory: 
$Projectpath$/scss/

One of the keys was to set the working directory correctly, for example $FileDir$ is just the SCSS file is in, so the relative paths are wrong.

screenshot file watcher

wittich
  • 2,079
  • 2
  • 27
  • 50