-
Notifications
You must be signed in to change notification settings - Fork 0
/
bebop.coffee
77 lines (66 loc) · 1.74 KB
/
bebop.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
exec = require 'executive'
fs = require 'fs'
path = require 'path'
writeFile = (dst, content) ->
fs.writeFile dst, content, 'utf8', (err) ->
console.error err if err?
compileCoffee = (src) ->
return
return unless /^src|src\/index.coffee$/.test src
exec 'cake build'
compileStylus = ->
src = 'src/css/theme.styl'
dst = 'lib/theme.css'
stylus = require 'stylus'
postcss = require 'poststylus'
autoprefixer = require 'autoprefixer'
comments = require 'postcss-discard-comments'
lost = require 'lost-stylus'
rupture = require 'rupture'
CleanCSS = require 'clean-css'
style = stylus fs.readFileSync src, 'utf8'
.set 'filename', src
.set 'paths', [
__dirname + '/src/css'
__dirname + '/node_modules'
]
.set 'include css', true
.set 'sourcemap',
basePath: ''
sourceRoot: '../'
.use lost()
.use rupture()
.use postcss [
autoprefixer browsers: '> 1%'
'lost'
'rucksack-css'
'css-mqpacker'
comments removeAll: true
]
style.render (err, css) ->
return console.error err if err
# if process.env.PRODUCTION
# minifier = new CleanCSS
# aggressiveMerging: false
# semanticMerging: false
# minified = minifier.minify css
# writeFile dst, minified.styles
# else
sourceMapURL = (path.basename dst) + '.map'
css = css + "/*# sourceMappingURL=#{sourceMapURL} */"
writeFile dst, css
writeFile dst + '.map', JSON.stringify style.sourcemap
true
module.exports =
port: 4242
cwd: process.cwd()
exclude: [
/lib/
/node_modules/
/vendor/
]
compilers:
css: -> false
coffee: compileCoffee
pug: compileCoffee
styl: compileStylus