Skip to content

Commit

Permalink
Merge pull request #15 from wickwire/grunt-build
Browse files Browse the repository at this point in the history
Warning: major code refactoring
  • Loading branch information
edfungus authored Jul 11, 2016
2 parents a42f993 + 41fdc2a commit a62cab5
Show file tree
Hide file tree
Showing 44 changed files with 270 additions and 132 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
node_modules/
public/common/bower/
clients/esp8266_clients/lua/init-secret.lua
161 changes: 150 additions & 11 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = function(grunt) {
require('jit-grunt')(grunt);

grunt.loadNpmTasks('grunt-contrib-pug');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-sync');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.initConfig({
less: {
development: {
Expand All @@ -9,25 +13,160 @@ module.exports = function(grunt) {
yuicompress: true,
optimization: 2
},
files: [{
expand: true,
src: ['public/app/framework/**/*.less','public/app/dashboard-elements/**/*.less','public/app/documentation/*.less','public/common/css/*.less'],
ext: '.css',
extDot: 'first'
}]
files: [
{
expand: true,
flatten: true,
cwd: 'public/',
dest: 'build/css',
src: [
'app/framework/**/*.less',
'app/dashboard-elements/**/*.less',
'app/documentation/*.less',
'common/css/*.less'
],
ext: '.css',
extDot: 'first'
}
]
}
},
pug: {
compile: {
options: {
pretty: true,
data: require('./static-paths.js')
},
files: [
{
expand: true,
flatten: true,
cwd: 'public/app', // Src matches are relative to this path.
src: ['**/*.pug'], // Actual pattern(s) to match.
dest: 'build/html', // Destination path prefix.
ext: '.html', // Dest filepaths will have this extension.
extDot: 'first' // Extensions in filenames begin after the first dot
}
]
}
},
sync: {
main: {
files: [
{
expand: true,
cwd: 'public/common',
flatten: true,
src: [
'bower/webcomponentsjs/*.js',
'bower/packery/dist/*.min.js',
'bower/draggabilly/dist/*.min.js',
'bower/jquery/dist/*.min.js',
'bower/chartist/dist/*.min.js',
'js/*',
],
dest: 'build/js/'
},
{
expand: true,
cwd: 'public/app/documentation',
flatten: true,
src: [
'*.js',
],
dest: 'build/js/'
},
{
expand: true,
cwd: 'public/app/documentation',
flatten: true,
src: [
'*.css',
],
dest: 'build/css/'
},
{
expand: true,
cwd: 'public/app/documentation',
flatten: true,
src: [
'*.md',
],
dest: 'build/'
},
{
expand: true,
cwd: 'public/common',
flatten: true,
src: [
'bower/chartist/dist/*.min.css',
'bower/font-awesome/css/*.min.css',
],
dest: 'build/css/'
},
{
expand: true,
cwd: 'public/common',
flatten: true,
src: [
'images/*'
],
dest: 'build/images/'
},
{
expand: true,
cwd: 'public/common',
flatten: true,
src: [
'bower/Materialize/fonts/roboto/*',
'bower/font-awesome/fonts/*',
],
dest: 'build/fonts/'
},
{
expand: true,
cwd: 'build/html',
src: [
'index.html'
],
dest: 'build/'
},
{
expand: true,
cwd: 'public/common/bower',
src: [
'**/*'
],
dest: 'build/static/common/bower'
}
]
}
},
clean: [
'build/html/index.html'
],
connect: {
server: {
options: {
port: 9000,
base: 'build'//,
//keepalive : true
}
}
},
watch: {
styles: {
files: ['public/app/framework/**/*.less','public/app/dashboard-elements/**/*.less','public/app/documentation/*.less','public/common/css/**/*.less'], // which files to watch
tasks: ['less'],
files: [
'public/**/*'
],
tasks: ['less', 'pug', 'sync', 'clean'],
options: {
livereload: true,
nospawn: true
}
}
}
});

grunt.registerTask('default', ['less', 'watch']);
grunt.registerTask('prod', ['less']);
grunt.registerTask('default', ['less', 'pug', 'sync', 'clean', 'connect', 'watch']);
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
"bower": "^1.5.2",
"express": "^4.13.3",
"grunt-contrib-pug": "0.0.0",
"grunt-sync": "^0.5.2",
"jit-grunt": "^0.9.1",
"pug": "^2.0.0-alpha6",
"readdirp": "^2.0.0"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "^0.6.1",
"jit-grunt": "^0.9.1"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
link(rel="import", href="/static/common/bower/polymer/polymer.html")
link(rel="import", href="/app-render/framework/crouton-card/crouton-card.pug")
link(rel="import", href="../static/common/bower/polymer/polymer.html")
link(rel="import", href="crouton-card.html")


dom-module(id="crouton-chart-donut")
template
link(rel="stylesheet", href="crouton-chart-donut.css")
link(rel="stylesheet", href="../css/crouton-chart-donut.css")
crouton-card
div.dragger
div.expand
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
link(rel="import", href="/static/common/bower/polymer/polymer.html")
link(rel="import", href="/app-render/framework/crouton-card/crouton-card.pug")
link(rel="import", href="../static/common/bower/polymer/polymer.html")
link(rel="import", href="crouton-card.html")


dom-module(id="crouton-chart-line")
template
link(rel="stylesheet", href="crouton-chart-line.css")
link(rel="stylesheet", href="../css/crouton-chart-line.css")
crouton-card
div.dragger
div.expand
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
link(rel="import", href="/static/common/bower/polymer/polymer.html")
link(rel="import", href="/static/common/bower/paper-slider/paper-slider.html")
link(rel="import", href="/app-render/framework/crouton-card/crouton-card.pug")
link(rel="import", href="../static/common/bower/polymer/polymer.html")
link(rel="import", href="../static/common/bower/paper-slider/paper-slider.html")
link(rel="import", href="crouton-card.html")


dom-module(id="crouton-rgb-slider")
template
link(rel="stylesheet", href="crouton-rgb-slider.css")
link(rel="stylesheet", href="../css/crouton-rgb-slider.css")
crouton-card
div.dragger
div.expand
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
link(rel="import", href="/static/common/bower/polymer/polymer.html")
link(rel="import", href="/static/common/bower/paper-fab/paper-fab.html")
link(rel="import", href="/static/common/bower/iron-icons/iron-icons.html")
link(rel="import", href="/static/common/bower/iron-icon/iron-icon.html")
link(rel="import", href="/static/common/bower/fontawesome-iconset/fa-all.html")
link(rel="import", href="/app-render/framework/crouton-card/crouton-card.pug")
link(rel="import", href="../static/common/bower/polymer/polymer.html")
link(rel="import", href="../static/common/bower/paper-fab/paper-fab.html")
link(rel="import", href="../static/common/bower/iron-icons/iron-icons.html")
link(rel="import", href="../static/common/bower/iron-icon/iron-icon.html")
link(rel="import", href="../static/common/bower/fontawesome-iconset/fa-all.html")
link(rel="import", href="crouton-card.html")


dom-module(id="crouton-simple-button")
template
link(rel="stylesheet", href="crouton-simple-button.css")
link(rel="stylesheet", href="../css/crouton-simple-button.css")
crouton-card
div.dragger
div.expand
Expand Down

This file was deleted.

Loading

0 comments on commit a62cab5

Please sign in to comment.