Code Monkey home page Code Monkey logo

cl-minify-css's Introduction

cl-minify-css

To minify css with common lisp.

Getting Started in cl-minify-css

Dependencies

No dependencies. Yes, I was crazy, and I did it without cl-ppcre by fun.

Download and Load

1 - Load cl-minify-css system by quicklisp

IN PROGRESS… but will be like this: (ql:quickload :cl-minify-css)

2 - Download and load cl-minify-css system by github and asdf

download from github:

git clone https://github.com/noloop/cl-minify-css.git

and load by asdf:

(asdf:load-system :cl-minify-css)

Note: Remember to configure asdf to find your directory where you downloaded the libraries (asdf call them “systems”) above, if you do not know how to make a read at: https://common-lisp.net/project/asdf/asdf/Configuring-ASDF-to-find-your-systems.html or https://lisp-lang.org/learn/writing-libraries.

How to minify a css string?

(defparameter css "/*By somebody | License GPLv3*/
div,ul,li:focus {
    outline:none; /*some comment*/
    margin: 5px 0 0 1px;
}

body {
  font: 1em/150% Helvetica, Arial, sans-serif;
  padding: 1em;
  margin: 0 auto; 
  max-width: 33em;
}

@media (min-width: 70em) {
  body {
    font-size: 130%; /*more some comment*/
  }
}

h1 {
  font-size: 1.5em;
}")
(minify-css css :keep-license-p nil)
;; => "div,ul,li:focus{outline:none;margin:5px 0 0 1px;}body{font:1em/150% Helvetica, Arial, sans-serif;padding:1em;margin:0 auto;max-width:33em;}@media (min-width:70em){body{font-size:130%;}}h1{font-size:1.5em;}"
(minify-css css :keep-license-p t)
;; => "/*By somebody | License GPLv3*/div,ul,li:focus{outline:none;margin:5px 0 0 1px;}body{font:1em/150% Helvetica, Arial, sans-serif;padding:1em;margin:0 auto;max-width:33em;}@media (min-width:70em){body{font-size:130%;}}h1{font-size:1.5em;}"

API

function (minify-css css &key keep-license-p)

cl-minify-css's People

Contributors

noloop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jgarte

cl-minify-css's Issues

Minify without the last ";" of the class properties values

Example:

Instead it:

body{padding:1em;margin:0 auto;max-width:33em;}@media (min-width:70em){body{font-size:130%;}}h1{font-size:1.5em;}

Minify thus:

body{padding:1em;margin:0 auto;max-width:33em}@media (min-width:70em){body{font-size:130%}}h1{font-size:1.5em}

Minify using threads for big css files

I think:

1 - What you need is think in data, so split all the CSS string in:

(("classe-names-1" (("k1" "v1") ("k2" "v2")))
 ("classe-names-2" (("k1" "v1")))
 (:media ("classe-names-1" (("k1" "v1")))
         ("classe-names-2" (("k1" "v1")))))

;; to do this: (defun css-to-cl-list (css) ...)

2 - Create rules functions to treat the minification of the css using the list above, when requested more of one thread so divide the list returned by css-to-cl-list in for the threads, and after put it all minified strings together, also allowing put they in file separated.

Minify without duplicated code

Example:

Instead it:

body{padding:1em;}body{padding:1em;}.some-class{padding:1em;}

Minify thus:

body,.some-class{padding:1em;}

License question

Hi, what license is this code released under? I see reference to GPLv3 in the README, but it's hard to tell if the package itself is released under GPLv3 or if that's just an example use. I am not permitted to incorporate GPL code into my system, so that is why I am asking.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.