1
0
mirror of https://github.com/onkelbeh/cheatsheets.git synced 2026-01-14 06:42:04 +01:00
cheatsheets/make-assets.md
Rico Sta. Cruz 511de900ba
Formatting updates (#2133)
- Update some sheets which have very long sections
- Remove `layout: 2017/sheet` (everything has the same layout now)
- Remove outdated sheets
2024-04-03 18:30:24 +11:00

955 B

title, tags, archived
title tags archived
Make for assets
Archived
This sheet may be listing practices that are outdated.

Basic compiling

bin := ./node_modules/.bin

all: build/foo.js

build/%.js: src/%.coffee
    @$(bin)/coffee < $^ > $@

Stylus + Autoprefixer

bin := ./node_modules/.bin
stylus := $(bin)/stylus
autoprefixer := $(bin)/autoprefixer
styl_files := $(shell find web/ -name "*.styl")

all: public/app.css

public/app.css: css/app.styl

%.css: %.styl $(styl_files)
    @$(stylus) $< | $(autoprefixer) -b "> 1%" > $@

Hint

hint:
   $(js_files)

Watching

watch:
    @echo "... watching for changes"
    @while true; do make -s; sleep 1; done

Browserify

js_files := $(shell find web/ -name "*.js")

public/app.js: web/app.js
public/vendor.js: web/vendor.js

public/%.js: web/%.js $(js_files)
    $(browserify) -t [ cssify -x .css ] $< > $@