Skip to content

Instantly share code, notes, and snippets.

@sapegin
Created August 15, 2012 08:42
Show Gist options
  • Save sapegin/3357685 to your computer and use it in GitHub Desktop.
Save sapegin/3357685 to your computer and use it in GitHub Desktop.
Sapegin.me gruntfile
/**
How to build this project?
1. Install Grunt:
npm install grunt -g
mkdir node_modules
npm install grunt-stylus grunt-sweet grunt-imgo
2. Build:
grunt
*/
/*global module:false*/
module.exports = function(grunt) {
'use strict';
// Project configuration
grunt.initConfig({
meta: {
banner: '/*! Author: Artem Sapegin, http://sapegin.me, <%= grunt.template.today("yyyy") %> */'
},
lint: {
files: [
'grunt.js',
'htdocs/js/mylibs/*.js',
'htdocs/js/main.js'
]
},
concat: {
main: {
src: [
"htdocs/js/libs/social-likes.min.js",
"htdocs/js/mylibs/jquery.tagfilter.js",
"htdocs/js/mylibs/jquery.hoverscroller.js",
"htdocs/js/mylibs/jquery.polaroidstack.js",
"htdocs/js/utils.js",
"htdocs/js/main.js"
],
dest: 'htdocs/build/scripts.js'
},
about: {
src: [
"htdocs/js/libs/highcharts/highcharts.js",
"htdocs/js/libs/leaflet/leaflet.js",
"htdocs/js/libs/doT.min.js",
"htdocs/embeds/whereami/script.js",
"htdocs/embeds/pulse/script.js"
],
dest: "htdocs/build/about.js"
},
history: {
src: [
"htdocs/js/libs/gamesoup/jsgamesoup.js",
"htdocs/js/libs/gamesoup/sprite.js",
"htdocs/js/libs/gamesoup/collisions.js",
"htdocs/js/libs/gamesoup/random.js",
"htdocs/embeds/ironman/script.js"
],
dest: "htdocs/build/history.js"
}
},
min: {
main: {
src: [
'<banner:meta.banner>',
'<config:concat.main.dest>'
],
dest: 'htdocs/build/scripts.min.js'
},
about: {
src: [
'<banner:meta.banner>',
'<config:concat.about.dest>'
],
dest: 'htdocs/build/about.min.js'
},
history: {
src: [
'<banner:meta.banner>',
'<config:concat.history.dest>'
],
dest: 'htdocs/build/history.min.js'
}
},
stylus: {
compile: {
files: {
'distribution/<%= grunt.template.today("yyyy") %>.css': 'library/<%= grunt.template.today("yyyy") %>.styl',
'htdocs/build/styles.css': 'styles/index.styl',
'htdocs/build/pages.css': 'styles/pages.styl'
},
options: {
'include css': true,
urlfunc: 'embedurl',
paths: [
'styles'
]
}
}
},
sweet: {
content_dir: 'content',
publish_dir: 'htdocs',
templates_dir: 'templates',
default_template_id: 'page',
langs: [
'ru',
'en'
],
url_prefixes: {
ru: 'http://sapegin.ru/',
en: 'http://sapegin.me/'
},
uri_prefixes: {
ru: '/',
en: '/'
},
files: {
css: {
path: "htdocs/build/styles.css",
href: "/build/styles.css?{version}"
},
pagesCss: {
path: "htdocs/build/pages.css",
href: "/build/pages.css?{version}"
},
js: {
path: "htdocs/build/scripts.min.js",
href: "/build/scripts.min.js?{version}"
},
aboutJs: {
path: "htdocs/build/about.min.js",
href: "/build/about.min.js?{version}"
},
historyJs: {
path: "htdocs/build/history.min.js",
href: "/build/history.min.js?{version}"
}
}
},
imgo: {
imgo: {
files: 'htdocs/images/*'
}
},
watch: {
stylus: {
files: 'styles/**',
tasks: 'stylus'
},
sweet: {
files: [
'<%= sweet.content_dir %>/**',
'<%= sweet.templates_dir %>/**'
],
tasks: 'sweet'
}
},
server: {
port: 8000,
base: '<config:sweet.publish_dir>'
},
jshint: {
options: {
browser: true,
white: false,
smarttabs: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
undef: true,
jquery: true
},
globals: {
Modernizr: true,
jQuery: true
}
},
uglify: {}
});
grunt.loadNpmTasks('grunt-stylus');
grunt.loadNpmTasks('grunt-sweet');
grunt.loadNpmTasks('grunt-imgo');
// Project tasks
grunt.registerTask('default', 'imgo stylus lint concat min sweet');
grunt.registerTask('deploy', 'stylus concat min sweet');
grunt.registerTask('serve', 'server watch');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment