Created
January 27, 2014 19:52
-
-
Save nakajmg/8655997 to your computer and use it in GitHub Desktop.
Grunt workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* autoprefixer */ | |
module.exports = { | |
options: { | |
browsers: ['ios >= 5', 'android >= 2.3'] | |
}, | |
dist: { | |
src: "./css/style.css" | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* config */ | |
module.exports = { | |
connect: require("./connect"), | |
watch: require("./watch"), | |
sass: require("./sass"), | |
copy: require("./copy"), | |
csso: require("./csso"), | |
uglify: require("./uglify"), | |
autoprefixer: require("./autoprefixer") | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* connect */ | |
module.exports = { | |
dist: { | |
options: { | |
port: 5000, | |
base: ".", | |
open: "http://localhost:5000" | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* csso */ | |
module.exports = { | |
dist: { | |
files: { | |
"./css/style.min.css": ["./css/style.css"] | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
var configObject, packageJson; | |
// 使いたいタスクが書いてあるconfigファイルを読み込む | |
configObject = require("./Gruntconfig/config"); | |
// package.jsonを読み込む | |
packageJson = grunt.file.readJSON("package.json"); | |
grunt.config.init(configObject); | |
// package.jsonに記述されたgruntタスクを読み込む | |
Object.keys(packageJson.devDependencies).slice(1).forEach(grunt.loadNpmTasks); | |
grunt.registerTask("default", ["connect", "watch"]); | |
grunt.registerTask("publish", ["sass", "autoprefixer", "csso"]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "GruntTemplate", | |
"version": "0.0.1", | |
"description": "my grunt template", | |
"main": "Gruntfile.coffee", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "nakajmg", | |
"license": "MIT", | |
"readmeFilename": "README.md", | |
"devDependencies": { | |
"grunt": "~0.4.2", | |
"grunt-contrib-watch": "~0.5.3", | |
"grunt-contrib-sass": "~0.6.0", | |
"grunt-contrib-connect": "~0.5.0", | |
"grunt-csso": "~0.5.2", | |
"grunt-autoprefixer": "~0.6.4" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* sass */ | |
module.exports = { | |
dist: { | |
files: [ | |
{ | |
expand: true, | |
cwd: "./css/", | |
src: ["*.scss"], | |
dest: "./css/", | |
ext: ".css" | |
} | |
] | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* watch */ | |
module.exports = { | |
sass: { | |
files: ["./css/*scss"], | |
tasks: ["sass", "autoprefixer"], | |
options: { | |
livereload: true | |
} | |
}, | |
reload: { | |
files: ["./*.html", "./js/*.js"], | |
options: { | |
livereload: true | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment