2

I am currently working on getting automatic SCSS -> CSS conversion set up using PyCharm's File Watcher functionality. I am able to have the files output to another directory, but I cannot get them to do it relative to a specific directory. Currently, I have the following settings and relevant file tree:

Tree

|media/
|-c/
| |-css/
|   |-folder/
|   |  |-file2.css
|   --file.css
--src/
  |-css/
    |-folder/
    | |-file2.scss
    --file.scss

File Watcher Settings

  • Scope is the media/src/css/ directory and all subdirectories recursively
  • Arguments is --no-cache --update $FileName$:$ProjectFileDir$/media/c/$FileDirRelativeToProjectRoot$/$FileNameWithoutExtension$.css
  • Working directory is $ProjectFileDir$/media/src/css/
  • Output paths to refresh is $ProjectFileDir$/media/c/$FileDirRelativeToProjectRoot$/$FileNameWithoutExtension$.css

With these settings, when I update file2.scss, there is an error stating that media/c/media/src/css/folder does not exist, which is not where I want the file anyway.

The issue that I am having is that I would like to have all paths relative to the working directory root preserved (ie. media/src/css/folder -> media/c/css/folder, but all of my source SCSS files are under multiple folder levels from the project root and the tutorial only specifies how to maintain folder structure if you are compiling directly below the root, not a folder below the root. Does anyone know a way that my folder structure could be preserved so that anything under media/src/css would have the same relative output in media/c/css?

cimmanon
  • 67,211
  • 17
  • 165
  • 171
Stephen Ross
  • 110
  • 1
  • 9
  • I have exactly the same problem. One folder with structure and scss, the other with same structure but transpiled css. Didn't find a solution yet either :/ – darkless Apr 12 '17 at 20:45

1 Answers1

1

The CrazyCoder posted solution in another Question. It is hard to find, so I'm linking it. https://stackoverflow.com/a/15965088/2047157

Quoting:

The trick is to use $FileDirPathFromParent(dir)$ macro:

Community
  • 1
  • 1
darkless
  • 1,304
  • 11
  • 19