1
1
mirror of https://github.com/primer/css.git synced 2024-11-29 06:02:33 +03:00
css/Gruntfile.js

106 lines
2.3 KiB
JavaScript
Raw Normal View History

module.exports = function(grunt) {
grunt.initConfig({
// Project configuration.
pkg: grunt.file.readJSON('package.json'),
// Compiles our Sass
sass: {
options: {
precision: 6,
sourceComments: false,
outputStyle: 'compressed'
},
dist: {
files: {
'css/primer.css': 'scss/primer.scss'
}
}
},
// Handle vendor prefixing
autoprefixer: {
options: {
browsers: ['last 2 versions', 'ie 8', 'ie 9']
},
dist: {
src: 'css/*.css'
},
},
// Runs CSS reporting
parker: {
options: {
metrics: [
'TotalStylesheets',
'TotalStylesheetSize',
'TotalRules',
'TotalSelectors',
'TotalIdentifiers',
'TotalDeclarations',
'SelectorsPerRule',
'IdentifiersPerSelector',
'SpecificityPerSelector',
'TopSelectorSpecificity',
'TopSelectorSpecificitySelector',
'TotalIdSelectors',
'TotalUniqueColours',
'TotalImportantKeywords',
'TotalMediaQueries'
],
file: "css/.primer-stats.md",
usePackage: true
},
src: [
'css/*.css'
],
},
// Build tooling
watch: {
sass: {
files: 'scss/**/*.scss',
tasks: ['sass', 'autoprefixer', 'parker']
}
},
jekyll: {
options: {
src: 'docs',
dest: '_site',
config: '_config.yml'
}
},
buildcontrol: {
options: {
dir: '_site',
commit: true,
push: true,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
},
pages: {
options: {
2015-03-23 20:20:05 +03:00
remote: 'git@github.com:primer/primer.git',
branch: 'gh-pages'
}
}
}
});
// Load dependencies
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-build-control');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-parker');
grunt.loadNpmTasks('grunt-sass');
// Generate and format the CSS
grunt.registerTask('default', ['sass', 'autoprefixer', 'parker']);
// Publish to GitHub
grunt.registerTask('publish', ['jekyll', 'buildcontrol:pages']);
};