realchaseadams commented on Sep 16, 2014
I wouldn’t do anything seriously (sorry if I came across as suggesting there was any real gravity), but I would genuinely argue that a pre-processed asset doesn’t belong in the /static
directory (because it’s not static, it’s dynamic), nor should it be processed by, a static website generator.
Hugo won’t watch a directory it’s not told to watch, and in the case of any pre-processed asset, I’d argue that it deserves to be in a directory outside of the /static
directory.
Architecturally, I personally have a /src
directory with sass & js files, because I’m ultimately going to want to process and mutate them in a production build, minified, with asset references revved, and not “put” the original SASS or CoffeeScript or LESS files into the public directory, since they don’t have a purpose there.
I will run hugo server --watch
and my default gulp
task, which watched the /src
directory for changes, processes assets and writes the new files into the /static
directory, which hugo copies into the /public
directory. This process works really well for me, and I find that my workflow is better off for it, as well as keeping your statically built assets out of version control if you add /static/css
and /static/js
to your .gitignore
(which I do because I believe built/compiled files don’t belong in version control).
When you consider trying to ask hugo to do something like this, there are a lot of architectural decisions you’d have to make:
- Is sass going to be a flag?
- If you incorporate it, is there a schema for where the sass files should live, or should you let the user define it in the config?
- If you’re going to have sass as an option, why not offer less, compass, coffeescript, all the other pre-processors that are involved in a workflow?
You made a great point about Hugo being an HTML pre-processor, but I think it speaks more to the fact that Hugo should just be that, an HTML preprocessor that copies static assets into an output directory. The advantage of Hugo is that it’s really fast at compiling html assets and copying. Aside from the ease of not having to run sass in a separate shell, what advantage would one gain from having Hugo run a shell command?
I just contribute to the conversation and the cod sometimes, so ultimately the decision isn’t up to me, and this is my two cents, which in any economy is pretty worthless, so the decision to incorporate a wrapper for something to compile your sass for you isn’t up to me.