[ANN] shake-minify and shake-pack

26 views
Skip to first unread message

Luke Hoersten

unread,
Mar 3, 2015, 11:13:19 AM3/3/15
to shake-bui...@googlegroups.com
Hello,

I've released three generalized Shake rules in two new libraries on Hackage:
  1. shake-minify uses native Haskell code (no external $PATH dependencies) to minify CSS and JS files. (https://hackage.haskell.org/package/shake-minify)
  2. shake-pack uses bz2 lib on the system to tar and bzip compress given files. (https://hackage.haskell.org/package/shake-pack)
These rules are pretty straight forward but useful enough to pull them out of reimplementations. Comments and pull requests welcome.

One reason I've heard from people using Gulp, Gradle, or Rake instead of Shake (even on Haskell projects) is the ecosystem of pre-built tasks (rules). I'm sure many people on this list have a portfolio of Shake rules they regularly use so I'm making an effort myself to generalize these and throw them on Hackage.

I've also added a Shake category on Hackage to help people locate generalized rules and utils:

Thanks,
Luke

Neil Mitchell

unread,
Mar 3, 2015, 12:59:43 PM3/3/15
to Luke Hoersten, shake-bui...@googlegroups.com
Hi Luke,

Thanks for sharing! I may end up using shake-minify myself.

> One reason I've heard from people using Gulp, Gradle, or Rake instead of
> Shake (even on Haskell projects) is the ecosystem of pre-built tasks
> (rules). I'm sure many people on this list have a portfolio of Shake rules
> they regularly use so I'm making an effort myself to generalize these and
> throw them on Hackage.

Great, thanks a lot. I agree that lots of rules is a great idea.

As yet, I'm not totally sure what a general build rule would look like
for most things. As an example, shake-minify takes care of mapping
*.js to *.min.js, but only works if the directories are the same. If
you've got a separate source and object directory, then that won't
work unless you also generate the .js file (which, nowadays, probably
is the standard).

> I've also added a Shake category on Hackage to help people locate
> generalized rules and utils:
> https://hackage.haskell.org/packages/#cat:Shake

Good idea. I've tagged Shake with that category, so the next release
will show up there too.

Thanks, Neil

Luke Hoersten

unread,
Mar 3, 2015, 1:03:33 PM3/3/15
to Neil Mitchell, shake-bui...@googlegroups.com
You're right I hadn't thought of the case where source and destination directories are different. I'll have to think about the best way to do that. Probably a way to handle more flexible naming in general (ex: don't prepend "min" to the extension). If you have any ideas, let me know or just submit a PR.

Thanks,
Luke

Neil Mitchell

unread,
Mar 3, 2015, 1:08:33 PM3/3/15
to Luke Hoersten, shake-bui...@googlegroups.com
I guess the full generality is providing a pattern ("//*.min.js") and
a way to map a pattern back to a source file (defaulting to (<.> "js")
. dropDirectory . dropDirectory)? It's somewhat a shame that you can't
say "//$1.min.js" comes from "$1.js" or something similar.

Luke Hoersten

unread,
Mar 3, 2015, 1:10:36 PM3/3/15
to Neil Mitchell, shake-bui...@googlegroups.com
A simple high-order function might be the way to go, allowing the user to pass a function of (FilePath -> FilePath).

Luke Hoersten

unread,
Mar 4, 2015, 12:45:10 PM3/4/15
to shake-bui...@googlegroups.com, Neil Mitchell
Custom file path mapping released:

Thanks for the recommendation, Neil.
Reply all
Reply to author
Forward
0 new messages