forked from tom-spalding/nebulousdog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
173 lines (172 loc) · 5.5 KB
/
Gruntfile.js
File metadata and controls
173 lines (172 loc) · 5.5 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
module.exports = function(grunt) {
grunt.initConfig({
THEME: 'themes/icosahedron',//my themes folder
OUTPUT_PATH: 'output', //default output path
PATH: 'content', //default content path
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['src/**/*.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
qunit: {
files: ['test/**/*.html']
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
sass:{
dist: {
options: {
style: 'compressed',
},
files: {
'themes/icosahedron/static/css/main.css':'themes/icosahedron/static/css/sass/main.scss'
}
}
},
watch: {
css: {
files: 'themes/icosahedron/static/css/sass/*.scss',
tasks: ['sass']
},
all: {
files: ['themes/**/*.css','themes/**/*.html','content/*','content/pages/*','**/*.py'],
tasks: ['pelican'],
options: {
livereload: true,
},
},
},
open: {
all: {
path: 'http://localhost:<%= express.all.options.port%>'
}
},
express: {
options: {
// Override the command used to start the server.
// (do not use 'coffee' here, the server will not be able to restart
// see below at opts for coffee-script support)
// cmd: process.argv[0],
// Will turn into: `node OPT1 OPT2 ... OPTN path/to/server.js ARG1 ARG2 ... ARGN`
// (e.g. opts: ['node_modules/coffee-script/bin/coffee'] will correctly parse coffee-script)
// opts: [ ],
// args: [ ],
// Setting to `false` will effectively just run `node path/to/server.js`
// background: true,
// Called when the spawned server throws errors
// fallback: function() {},
// Override node env's PORT
// port: 9000,
// Override node env's NODE_ENV
// node_env: undefined,
// Consider the server to be "running" after an explicit delay (in milliseconds)
// (e.g. when server has no initial output)
// delay: 0,
// Regular expression that matches server output to indicate it is "running"
// output: ".+",
// Set --debug
// debug: false,
},
all: {
options: {
port: 9000,
hostname: "0.0.0.0",
bases: ['output'],
livereload: true,//35729
}
},
dev: {
options: {
script: 'server.js'
}
},
prod: {
options: {
script: 'path/to/server.js',
node_env: 'production'
}
},
test: {
options: {
script: 'path/to/server.js'
}
}
},
exec: {
pygments: 'pygmentize -S monokai -f html -a .highlight > <%= THEME %>/static/css/sass/pygments.scss',
sass: 'sass --watch <%= THEME %>/static/css/sass/main.scss:<%= THEME %>/static/css/main.css',
pelican: 'pelican',
pelican_publish: 'pelican -s publishconf.py',
deploy_init: { //sometimes i accidently delete my git repo
cmd:
'git init && \
git remote add origin ssh://root@192.241.228.195/~/digitalvapor.git',
cwd: 'output',
},
//route_ip: 'sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000',
//http://nicolasgallagher.com/simple-git-deployment-strategy-for-static-sites/
deploy: {
cmd:
'git add -A && \
git commit -m "autodeploy" && \
git push -f origin +master:refs/heads/master && \
git tag -f production',
cwd: 'output',
},
// toggle_python2: 'npm config set python /usr/bin/python2.7 -g',
// toggle_python3: 'npm config set python /usr/bin/python3.4 -g',
// production_test: 'NODE_ENV=production node server.js',
// production_test2: 'node server.js production',
optimize_images: {
cmd: 'optipng -nc -np *.png',
cwd: 'output/images',
},
default: 'pelican',
},
});
//instead of the below, can use matchdep
//require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-express');
grunt.loadNpmTasks('grunt-open');
//grunt.resisterTask('optimize',['exec:optimize_images']);
grunt.registerTask('deploy_init',['exec:deploy_init']);
grunt.registerTask('pelican',['exec:pelican']);
grunt.registerTask('test', ['jshint', 'qunit']);
grunt.registerTask('server', ['express','open','watch']);
//grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
grunt.registerTask('default', ['express','open','watch']);
grunt.registerTask('compile', ['watch']);
grunt.registerTask('dev',['sass','jshint']);
grunt.registerTask('deploy',['exec:deploy']);
};