-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for preprocessors #16
Comments
Thinking about the issue a bit, I found the following things that would be a must to be able to specify in the config:
Not all of those would be required. If there is no command to preprocess everything then every file is converted individually. If there's a watch mechanism, then hugo doesn't have watch for changes in those files by itself. |
This seems like it's asking a lot of Hugo, as Hugo's responsibility is static site generation, not asset processing. You can easily use a build tool such as Make, gulp, grunt, golang's train and watch these files to the Hugo, as far as I know, is unaware of the actual assets in the |
That seems an odd distinction @realchaseadams – is Hugo not, essentially, an HTML preprocessor? Can you seriously argue that CSS isn't a part of a static web site? I was pondering SASS preprocessing since I'm using that to build a site, currently my scss files are in amongst the other files making the site which results in Hugo watch rebuilding once when I save the .scss files and once when compass watch has processed them into .css files in themes/mytheme/static/css – no big deal because it's so fast, but still – so what would best practice be? Keep scss/js etc entirely outside of the site folder? Does Hugo ignore /src? There's some attraction to letting 3rd party tools do the work they've been designed for, but I'm still having difficulty figuring out the best workflow, filesystem layout etc. So incorporating a wrapper for something like libsass is out of the question for Hugo? |
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 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 Architecturally, I personally have a I will run When you consider trying to ask hugo to do something like this, there are a lot of architectural decisions you'd have to make:
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. :) |
Interestingly, turns out there a css pre-processor written in Go called GCSS: https://github.com/yosssi/gcss If some type of css pre-processor support was to be incorporated into Hugo but without support for all of them, perhaps this would be a good one to go with (for no other reason than it being written in Go, for whatever that might be worth). It could be approached in a "zero config" spirit similar to the idea of Harp. Just a thought related to the topic of Hugo and css preprocessors. |
Hey guys, this is an awesome topic of conversation. I hope you don't mind, but I copied it over to Hugo's official discussion forums, which is a little more appropriate place for this to take place: http://discuss.gohugo.io/t/support-for-html-css-js-preprocessors/127 |
+1 I'd need a way to add sass support in order for me to migrate away from node.js/ruby static site generators to Hugo. |
Just discovering Hugo now and I like what I see so far. Lacking a pre-processor for Sass, or JS or compressing images isn't a big deal, although for Hugo to be successful in the long term, there needs to be an easy way to plug it into an end-to-end workflow. |
alistaircom: Indeed, preprocessors are a core feature of almost all of the most popular static site generators. An essential component of front-end dev these days. |
+1 |
+1 - Pre-processor support is a must for me. |
+1 please 😄 |
Until this is supported, I have published the template that I use built with Gulp: https://github.com/csuarez/hugo-gulp-template I hope that someone find it useful. |
I currently use https://github.com/rjeczalik/cmd to watch my It would be nice if Hugo's watcher ran sassc if available: @omeid Have you used either of Slurp's successors? I'm curious. @igregson I wonder how compatible GCSS is with Sass. For that approach, I think I'd be more interested in Sassc bindings for Go, so long as it was all statically linked into the Hugo download. |
I use Wellington as my sass processor cmd. Run it in watch mode alongside Hugo. If Wellington matures to the point where it's 100% Go, we could potentially use it as part of the Hugo site build. |
@moorereason I'm not sure if that makes sense in the long term. Much like asset concatenation, spriting becomes an anti-pattern when served with HTTP/2, for the same reasons. See #432 (comment). |
@nathany, agreed. I don't use sprites and don't care for them. That wasn't my point. Wellington uses libsass for many operations, so it's not a great solution for Hugo right now. But he's building out a pure Go sass parser to eventually have a pure Go solution. I think that's very relevant to Hugo and the Go ecosystem. |
@moorereason Sorry, I misunderstood. A pure Go sass parser would be awesome, esp. for embedding in tools like Hugo. Achieving and maintaining feature parity is certainly a challenge. |
Integrated Sass parser...except all the buzz is around PostCSS now ;) |
It would be great if |
Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't. If this is a bug and you can still reproduce this error on the latest If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. |
Fix infinite loop in NotRule.Evaluate
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
There should be some support for HTML/CSS/JS preprocessors even if it's just adding shell commands to run in the config.
The text was updated successfully, but these errors were encountered: