forked from t32k/maple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
145 lines (129 loc) · 3.92 KB
/
Gruntfile.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
module.exports = (grunt) ->
'use strict'
# Project configuration.
grunt.initConfig
# Metadata.
pkg: grunt.file.readJSON 'package.json'
# Parse CSS and add vendor-prefixed CSS properties using the Can I Use database.
autoprefixer:
options:
browsers: ['ios >= 5', 'android >= 2.3']
dist:
src: 'public/files/css/maple.css'
# Start a static web server.
# Reload assets live in the browser
connect:
app:
options:
port: 8080
base: 'build/'
open: 'http://localhost:8080/'
doc:
options:
port: 8081
base: 'doc/'
open: 'http://localhost:8081/'
# Sort CSS properties in specific order.
csscomb:
dist:
options:
config: '.csscombrc'
files:
'public/files/css/maple.css': ['public/files/css/maple.css']
# Lint CSS files.
csslint:
dist:
options:
csslintrc: '.csslintrc'
src: ['public/files/css/maple.css']
# Minify CSS files with CSSO.
csso:
dist:
options:
banner: """
/*
* Maple.css
* Copyright 2013 Koji Ishimoto
* Licensed under the MIT License
*/
"""
files:
'public/files/css/maple.min.css': ['public/files/css/maple.css']
# Optimize PNG, JPEG, GIF images with grunt task.
image:
options:
optimizationLevel: 3
dist:
files: [
expand: true
cwd: "public/files/img/sprite/"
src: ["**/*.{png,jpg,gif}"]
dest: "public/files/img/sprite/"
]
# KSS styleguide generator for grunt.
kss:
options:
css: 'public/files/css/maple.css'
template: 'doc/template'
dist:
files:
# dest : src
'doc/': ['src/stylesheets/']
# Grunt task to compile Sass SCSS to CSS
sass:
dist:
files:
'public/files/css/maple.css': 'src/stylesheets/maple.scss'
# Grunt task for creating spritesheets and their coordinates
sprite:
dist:
src: 'public/files/img/sprite/tabs/*.png'
destImg: 'public/files/img/sprite/tabs.png'
imgPath: '/files/img/sprite/tabs.png'
destCSS: 'public/files/css/sass/lib/_sprite.scss'
algorithm: 'binary-tree'
padding: 2
cssTemplate: 'public/files/img/sprite/spritesmith.mustache'
# cssOpts: { functions: false }
# Run tasks whenever watched files change.
watch:
options:
livereload: true
css:
files: ['src/stylesheets/**/*.scss', 'build/**/*.html']
tasks: ['stylesheet']
sprite:
files: ['public/files/img/sprite/*/*.png']
tasks: ['sprite']
# SVG to webfont converter for Grunt.
webfont:
dist:
src: 'src/svg/*.svg'
dest: 'public/files/font/'
destCss: 'src/stylesheets/lib/'
options:
font: 'myfont'
types: ['woff', 'ttf']
stylesheet: 'scss'
htmlDemo: false
syntax: 'bootstrap'
relativeFontPath: '/files/font/'
# Load the plugins.
grunt.loadNpmTasks 'grunt-kss'
grunt.loadNpmTasks 'grunt-sass'
grunt.loadNpmTasks 'grunt-csso'
grunt.loadNpmTasks 'grunt-image'
grunt.loadNpmTasks 'grunt-csscomb'
grunt.loadNpmTasks 'grunt-webfont'
grunt.loadNpmTasks 'grunt-spritesmith'
grunt.loadNpmTasks 'grunt-autoprefixer'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-csslint'
# Tasks.
grunt.registerTask 'default', ['develop']
grunt.registerTask 'stylesheet', ['sass', 'autoprefixer', 'csscomb', 'csslint']
grunt.registerTask 'develop', ['connect:app', 'watch']
grunt.registerTask 'typeset', ['webfont', 'stylesheet']
grunt.registerTask 'publish', ['stylesheet', 'kss','connect:doc', 'watch']
grunt.registerTask 'build', ['stylesheet', 'csso', 'image']