The cl-minify-css Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-minify-css Reference Manual

This is the cl-minify-css Reference Manual, version 1.0.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Wed Nov 04 12:27:49 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 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:

#+BEGIN_SRC
git clone https://github.com/noloop/cl-minify-css.git
#+END_SRC

and load by asdf:

#+BEGIN_SRC lisp 
(asdf:load-system :cl-minify-css)
#+END_SRC

*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?

#+BEGIN_SRC lisp 
(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;}"
#+END_SRC

** API

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



Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-minify-css

Maintainer

noloop <noloop@zoho.com>

Author

noloop <noloop@zoho.com>

Home Page

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

Source Control

(:git "git@github.com:noloop/cl-minify-css.git")

Bug Tracker

https://github.com/noloop/cl-minify-css/issues

License

GPLv3

Description

To minify css with common lisp.

Version

1.0.0

Source

cl-minify-css.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 cl-minify-css/src

Parent

cl-minify-css (system)

Location

src/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 cl-minify-css.asd

Location

cl-minify-css.asd

Systems

cl-minify-css (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 cl-minify-css/src/package.lisp

Parent

src (module)

Location

src/package.lisp

Packages

noloop.cl-minify-css


Previous: , Up: Lisp files   [Contents][Index]

4.1.3 cl-minify-css/src/cl-minify-css.lisp

Dependency

package.lisp (file)

Parent

src (module)

Location

src/cl-minify-css.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 noloop.cl-minify-css

Source

package.lisp (file)

Nickname

cl-minify-css

Use List

common-lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Functions

Function: class-name-without-spaces S

It returns a string without spaces, newlines and tabs for a given css class name. Example: (class-name-without-spaces "div p,
div p + p, h1,
#myid ") => "div p,div p+p,h1,#myid"

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: end-bracket-index CSS START-BRACKET

It returns the closing bracket index (here called end-bracket) of a given onpening bracket index (here called start-bracket) of one string (here called css).

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: make-string-from-chars CHAR-LIST

It returns a string for given char list. Example: (make-string-from-chars ’(#s #o #m #e)) => "some"

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: minify-css CSS &key KEEP-LICENSE-P

It minify a css code removing spaces, newlines, tabs, comments. If want keep the license comment use :keep-license-p t.

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: minify-css-class CSS &key KEEP-LICENSE-P

It returns the minified class string for a given css class string. If :keep-license-p t the comments that have "license" (non-case-sensitive) are kept. Example: (minify-css ".myclass { margin: .67em 0; /* some comment */
padding: 5px; } ") => ".myclass{margin:.67em 0;padding:5px;}"

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: properties-without-spaces S

It returns a string without spaces, newlines and tabs in the properties for given css. Example: (properties-without-spaces "margin: .67em 0;
padding: 5px; ") => "margin:.67em 0;padding:5px;"

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: remove-css-comments-recursive CSS &key START-SEARCH KEEP-LICENSE-P

It removes all comments of the css code, if :keep-license-p t the comments that have "license" (non-case-sensitive) are kept. Use :start-search <number> to remove the comments only after a start position string.

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: remove-spaces-newlines-tabs S

It returns a string without all spaces, newlines and tabs for given string. Example: (remove-spaces-newlines-tabs " hi, I’m here! ") => "hi,I’mhere!"

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: split-css-in-classes CSS &optional CLASSES

It returns a list with splited classes strings of a given css string. If the css has media-queries instead of a string is returned a list where the first is the media query, and the rest is the string classes. Example: (split-css-in-classes "body{color:red;}@media (min-width:30em){body{color:green;}div{font-size:1em;}}")
=> ("body{color:red;}"
("@media (min-width:30em)"
("body{color:green;}"
"div{font-size:1em;}")))

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)

Function: trim S

It returns a string without all spaces, newlines and tabs in its extremes, this functions doesn’t make nothing about the middle of the string. Example: (string-trim " hi, I’m here! ") => "hi, I’m here!"

Package

noloop.cl-minify-css

Source

cl-minify-css.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-minify-css.asd: The cl-minify-css․asd file
cl-minify-css/src: The cl-minify-css/src module
cl-minify-css/src/cl-minify-css.lisp: The cl-minify-css/src/cl-minify-css․lisp file
cl-minify-css/src/package.lisp: The cl-minify-css/src/package․lisp file

F
File, Lisp, cl-minify-css.asd: The cl-minify-css․asd file
File, Lisp, cl-minify-css/src/cl-minify-css.lisp: The cl-minify-css/src/cl-minify-css․lisp file
File, Lisp, cl-minify-css/src/package.lisp: The cl-minify-css/src/package․lisp file

L
Lisp File, cl-minify-css.asd: The cl-minify-css․asd file
Lisp File, cl-minify-css/src/cl-minify-css.lisp: The cl-minify-css/src/cl-minify-css․lisp file
Lisp File, cl-minify-css/src/package.lisp: The cl-minify-css/src/package․lisp file

M
Module, cl-minify-css/src: The cl-minify-css/src module

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   E   F   M   P   R   S   T  
Index Entry  Section

C
class-name-without-spaces: Exported functions

E
end-bracket-index: Exported functions

F
Function, class-name-without-spaces: Exported functions
Function, end-bracket-index: Exported functions
Function, make-string-from-chars: Exported functions
Function, minify-css: Exported functions
Function, minify-css-class: Exported functions
Function, properties-without-spaces: Exported functions
Function, remove-css-comments-recursive: Exported functions
Function, remove-spaces-newlines-tabs: Exported functions
Function, split-css-in-classes: Exported functions
Function, trim: Exported functions

M
make-string-from-chars: Exported functions
minify-css: Exported functions
minify-css-class: Exported functions

P
properties-without-spaces: Exported functions

R
remove-css-comments-recursive: Exported functions
remove-spaces-newlines-tabs: Exported functions

S
split-css-in-classes: Exported functions

T
trim: Exported functions

Jump to:   C   E   F   M   P   R   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   N   P   S  
Index Entry  Section

C
cl-minify-css: The cl-minify-css system

N
noloop.cl-minify-css: The noloop․cl-minify-css package

P
Package, noloop.cl-minify-css: The noloop․cl-minify-css package

S
System, cl-minify-css: The cl-minify-css system

Jump to:   C   N   P   S