Rock is an asset manager for Common Lisp. It's basically a combination of Bower and webassets.
Rock takes care of downloading specific versions of libraries – jQuery, Bootstrap, FontAwesome – and bundling their files together so you can compile all your JavaScript and CSS into single files.
Features
- Library Manager: Download specific versions of the most common libraries. You can have multiple versions of the same library, for example, for migrating an application one subset at a time.
- Asset Bundling: Compile the JS/CSS files of different libraries and your own files into a single file.
How it Works
Here's the Rock environment definition for this website:
;; We define an environment for the 'rock' ASDF system
(defenv :rock
;; These are our dependencies
:assets ((:jquery :2.1.1)
(:bootstrap :3.2.0)
(:highlight-lisp :0.1))
:bundles ((:js
;; This is a JS bundle. It compiles the JS files
;; of the dependencies below:
:assets ((:jquery :2.1.1)
(:bootstrap :3.2.0)
(:highlight-lisp :0.1))
;; Our custom JS: assets/js/scripts.js
:files (list #p"js/scripts.js")
;; Combined JS file: assets/build/js/scripts.js
:destination #p"js/scripts.js")
(:css
;; This is a CSS bundle. Note that we don't
;; include jQuery
:assets ((:bootstrap :3.2.0)
(:highlight-lisp :0.1))
:files (list #p"css/style.css")
:destination #p"css/style.css")))
;; Download the assets and compile the bundles for this
;; environment. Dependencies are only downloaded when
;; they're needed.
(build :rock)
When the assets are built, you can start serving them using your favorite web framework.
Defining Custom Assets
Sometimes you need to use a custom asset, like a small library that's not included in Rock's known assets. Rock makes it simple to add new assets before defining an environment.
Assets are defined with the defasset
macro. The first argument is the name of
the asset (A symbol, not a keyword), and the second is the name of the asset
class, and then the keyword arguments describing the asset.
The following asset classes are defined:
<google-asset>
: Assets from Google's CDN.<bootstrap-cdn-asset>
: Assets from the Bootstrap CDN.<cdnjs-asset>
: Assets from cdnjs.<github-asset>
: Assets extracted from GitHub repos.
All assets share the following keyword arguments:
:name
- The asset's internal name. This is what will go in the file download URL, so
for example for
:angular.js
it's"angularjs"
because that how Google's CDN likes it. :versions
- In most assets, this is simply a list of keywords, where each keyword
represents a version, like
:1.2.3
or:1.2-beta
. In the case of GitHub assets, this is a list of(version-keyword . commit-string)
pairs. :js
,:css
- A list of paths to the JS and CSS files the asset provides. For most
JavaScript libraries, this is usually just a
.min.js
file.
For GitHub assets, :name
refers to the name of the repository, and you have to
provide a value to the :username
argument, the GitHub username in which the
library is stored.
You can also read Rock's built-in assets list to know how actual assets are defined.
Getting It
Until Rock is available on the Quicklisp repository, simply clone the repo
to your local-projects
directory:
$ cd quicklisp/local-projects
$ git clone https://github.com/eudoxia0/rock
Available Assets
This is a list of assets that come built in with Rock. If you have a custom asset you use often, or an asset that's not included in Rock by default, you should open an issue asking for its addition, or make a pull request including the asset definition.
Click on an asset's name to see the list of versions.
- Versions:
:1.2.26
:1.2.25
:1.2.24
:1.2.23
:1.2.22
:1.2.21
:1.2.20
:1.2.19
:1.2.18
:1.2.17
:1.2.16
:1.2.15
:1.2.14
:1.2.13
:1.2.12
:1.2.11
:1.2.10
:1.2.9
:1.2.8
:1.2.7
:1.2.6
:1.2.5
:1.2.4
:1.2.3
:1.2.2
:1.2.1
:1.2.0
:1.0.8
:1.0.7
:1.0.6
:1.0.5
:1.0.4
:1.0.3
:1.0.2
:1.0.1
:1.3.0-rc.5
:1.3.0-rc.4
:1.3.0-rc.3
:1.3.0-rc.2
:1.3.0-rc.1
:1.3.0-rc.0
:1.3.0-beta.19
:1.3.0-beta.18
:1.3.0-beta.17
:1.3.0-beta.16
:1.3.0-beta.15
:1.3.0-beta.14
:1.3.0-beta.13
:1.3.0-beta.12
:1.3.0-beta.11
:1.3.0-beta.10
:1.3.0-beta.9
:1.3.0-beta.8
:1.3.0-beta.7
:1.3.0-beta.6
:1.3.0-beta.5
:1.3.0-beta.4
:1.3.0-beta.3
:1.3.0-beta.2
:1.3.0-beta.1
- Versions:
:2.1.1
:2.1.0
:2.0.3
:2.0.2
:2.0.1
:2.0.0
:1.11.1
:1.11.0
:1.10.2
:1.10.1
:1.10.0
:1.9.1
:1.9.0
:1.8.3
:1.8.2
:1.8.1
:1.8.0
:1.7.2
:1.7.1
:1.7.0
:1.6.4
:1.6.3
:1.6.2
:1.6.1
:1.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