eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.47k stars 314 forks source link

Addding package plugin: a way to condense all of your files and minimize http requests #60

Closed jbonta closed 10 years ago

jbonta commented 10 years ago

I've been using this for my own website and it helps me sleep at night, knowing my crap is minified and packaged.

meyer commented 10 years ago

Matter of preference: I use grunt with a few plugins (svgo, scss, closure-compiler, yui-compressor) to do this all before pre-deploy. It allows for a lot of flexibility around how files are minified and where they’re dumped.

This plugin would be super awesome if it added a css/js template tag that changed the file URL to the compressed URL on deploy a la django-compressor.

jbonta commented 10 years ago

to be clear, this does change the file urls on deploy. No template syntax though. Instead I opted for automatic packaging based on what gets included across every page of the site.

I would almost prefer to use template directives to blacklist a region, rather that specifying which files I want to compress (I support blacklisting via the data-nopackage attribute, but it's not as cool).

Yeah, grunt is pretty sweet!

koenbok commented 10 years ago

Wow this is pretty sweet Jason! I'll merge this.

We're currently working on Cactus 3 which changed quite a bit (although should be mostly compatible) and you might have to change some small things for this to work again. You can find the source here: https://github.com/koenbok/Cactus/tree/v3

koenbok commented 10 years ago

Mike, in Cactus v3 we made a static directive that would allow us to do pre processing more easily. We already added fingerprinting to it too.

krallin commented 10 years ago

Note that pre-processing itself (including minification) is already in Cactus v3 too ; )

We also have support for integration with tools that merge multiple files (e.g. require.js)

Cheers,

On Fri, Oct 4, 2013 at 12:46 PM, Koen Bok notifications@github.com wrote:

Mike, in Cactus v3 we made a static directive that would allow us to do pre processing more easily. We already added fingerprinting to it too.

— Reply to this email directly or view it on GitHubhttps://github.com/koenbok/Cactus/pull/60#issuecomment-25690497 .

jbonta commented 10 years ago

yeah, parts of this definitely become irrelevant if you use dependency management like require.js. But this does pretty well for basic cases, letting you include as many css/js files in your markup as you need to without having to worry about extra request overhead.

Looking forward to checking out v3!

meyer commented 10 years ago

@koenbok ah man, that sounds rad. I still need to take the v3 branch for a spin.