Skip to content

Commit

Permalink
Add more automation features
Browse files Browse the repository at this point in the history
  • Loading branch information
joejoinerr committed Jun 22, 2015
1 parent f8b97e8 commit 6bcbd5c
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Folders
node_modules/
Build/
dist/
tumblr-boilerplate.wiki/

# Files
Expand Down
135 changes: 105 additions & 30 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,110 @@
module.exports = function(grunt) {
// Create configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssmin: {
minify: {
expand: true,
cwd: 'css/',
src: '*.css',
dest: '.tmp/',
ext: '.min.css'
}

// Create configuration
grunt.initConfig({

// Read packages
pkg: grunt.file.readJSON("package.json"),

// LibSass preprocessing
sass: {
options: {
includePaths: ["bower_components"],
precision: 5,
},
dev: {
files: [{
expand: true,
cwd: "sass",
src: ["**/*.scss"],
dest: "css",
ext: ".css"
}],
options: {
outputStyle: "expanded",
sourceMap: true
}
},
dist: {
files: [{
expand: true,
cwd: "sass",
src: ["**/*.scss"],
dest: "css",
ext: ".min.css"
}],
options: {
outputStyle: "compressed",
}
}
},

// Send CSS to HTML file
htmlbuild: {
dist: {
src: "index.html",
dest: "dist/",
},
options: {
styles: {
main: "css/*.min.css"
}
}
},

// Clean

// CSS linting
csslint: {
lint: {
options: {
"import": 2,
"box-model": false,
"box-sizing": false,
"unique-headings": false,
"universal-selector": false
},
htmlbuild: {
dist: {
src: 'index.html',
dest: 'Build/',
},
options: {
styles: {
main: '.tmp/*.min.css'
}
}
src: ["css/main.css"]
}
},

// Start server
connect: {
server: {
options: {
livereload: true
}
}
},

// Watch and reload compiled stylesheets
watch: {
sass: {
files: "sass/**/*.scss",
tasks: ["sass:dev"],
},
livereload: {
options: {
livereload: true,
},
clean: [ '.tmp/' ]
});
files: ["*.html", "css/**/*.css"]
}
}

});

// Load plugins
grunt.loadNpmTasks("grunt-sass");
grunt.loadNpmTasks("grunt-html-build");
grunt.loadNpmTasks("grunt-contrib-csslint");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-watch");

// Run tasks
grunt.registerTask("default", ["sass:dev", "connect", "watch"]);
grunt.registerTask("build", ["sass:dev"]);
grunt.registerTask("lint", ["sass:dev", "csslint"]);
grunt.registerTask("dist", ["sass:dist", "htmlbuild"]);

// Register the plugins
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-html-build');
grunt.loadNpmTasks('grunt-contrib-clean');
};

// Run the task
grunt.registerTask('default', ['cssmin', 'htmlbuild', 'clean']);
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tumblr-boilerplate",
"version": "0.5.0",
"version": "0.6.0",
"description": "A basic starting point for Tumblr theme development.",
"main": "Gruntfile.js",
"author": {
Expand All @@ -14,10 +14,12 @@
"license": "MIT",
"private": true,
"devDependencies": {
"grunt": "~0.4.1",
"js-beautify": "~1.3.4",
"grunt": "^0.4.5",
"grunt-contrib-connect": "^0.10.1",
"grunt-contrib-csslint": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-html-build": "~0.2.0",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-contrib-clean": "~0.5.0"
"grunt-sass": "^1.0.0",
"js-beautify": "~1.3.4"
}
}

0 comments on commit 6bcbd5c

Please sign in to comment.