Mirror

Volodymyr Tkach 753b1247ef Don't cache local files 1 year ago
.cache 5c41da64c8 Create .keep 2 years ago
css 68b9ea1ee6 Update ios.css 1 year ago
js 1db0cf3b2d Add AjaxInit func 1 year ago
test 961815e4a8 Ability to include local files 1 year ago
.gitignore 986e6165e3 Update .gitignore 2 years ago
LICENSE 7072494e1b Initial commit 2 years ago
Makefile 99fc01dbb0 Submakefile 2 years ago
README.md 49f0d18268 Update README.md 1 year ago
assets.makefile 5da255d126 Better yui-compressor check 2 years ago
assets.sh 753b1247ef Don't cache local files 1 year ago

README.md

assets

Collection of web assets for reuse in other projects. The main goal of all of this, it's making to possible import and reuse CSS and JS code for usual CSS and JS files, without any of something like Sass for CSS or NodeJs for JS, just simple CSS/JS and unix utilites. Additionaly yui-compressor utility is used for files minification. It's used by default and don't works without yui-compressor but you can modify makefile assets.makefile and remove --check-yui-compressor target everywhere

How to use

Install yui-compressor tool:

sudo apt-get install yui-compressor

Include to your main makefile:

.assets.makefile:
    curl -fsSL -o $@ https://raw.githubusercontent.com/vladimirok5959/assets/main/assets.makefile

include .assets.makefile

Add to gitignore file:

/.cache/
.*.makefile
assets.sh

Keep your CSS and JS files with *.dev.css and *.dev.js suffix. Run make assets command to process all finded files starting recursively from your makefile (root project) directory

You can include CSS/JS local files or CSS/JS file from internet into local file by import() command inside CSS/JS file. Check /test/ directory and /test/test.dev.css file. For example:

/* import(https://path/to/file/reset.css) */
/* import(https://path/to/file/controls/checkbox/ios.css) */

/* import(./local-file.css) */
/* import(./another/local-file.css) */

.example {
    background-color: red;
}

In the result you will get combined and minified CSS file without .dev. suffix. And the same works for JS files. Note: for reducing http requests /.cache/ directory is used. Run make assets-clear-cache to clear cached files