Closed logankaser closed 7 years ago
I'll probably end up doing that eventually. Since this was a master's thesis project, by the end I was rushing to implement newer techniques and improve results, and I didn't have much time to really think through some of the design decisions. Now that that is done, I'd like to slow down a bit and clean it up before implementing much more.
Anyway, I'll keep your request among my priorities. If you have any idea about how the API would be, I'm all ears!
Okay, you can find the library here: https://github.com/contivero/nimsah
I'll make sure I'm not missing anything critical before uploading it to hackage. The current repository will continue to be for the minifier, which I'll modify to use the library once it is on hackage.
Wow! That was so fast! I'll check it out after a little while and provide any feedback I can.
After an IRC conversation, I think it is better to leave it here. I'll push the changes I got to do on the other repo to this one, and leave this open for a while in case you want provide any feedback.
Once I manage to get this to hackage, you can use it as any other library, importing what you care about, and ignoring the executable part. I'll make sure to provide some simple functions as an API, and you can tell me what you think.
The package is on hackage: https://hackage.haskell.org/package/hasmin-0.3.0.1
I recommend that you import Hasmin
, and use the functions minifyCSS
and minifyCSSWith
from the Hasmin module (there is a rough example in the docs). Those two functions should generally suffice.
If you need anything else let me know.
I added a minification flag to Cell, very cool! I noticed one thing though, is there any reason you can't group media queries? It seems like that could save a lot of space in certain situations. I have more information to work with internally in Cell, so grouping media queries is something I can easily add to the minification flag. Just thought I'd mention it as an interesting strategy for you.
I'm glad you found it useful!
As for the media queries, no particular reason, I just prioritized implementing other things before. I've noticed that although restructuring can give considerable size reductions in the minified output, the difference usually isn't that significant once you compress everything with gzip, so hasmin is lacking in some restructuring techniques other minifiers have (but usually makes up for it with other things).
If it's not much to ask, could you open another issue with it, and a small example of what you mean?
I'm working on adding support for @supports
rules, and haven't really given any thought to grouping media queries. An example would really help me once I tackle that.
I'm closing this issue since exposing the library is already done. Thanks for the ideas and the feedback!
I have written a haskell CSS tool called Cell. I would love to use this as a libary to minify Cell's output as It is better than the other implementations I have found. Have you considered converting this into a libary and implementing the tool using it?