1.1 --- a/bootstrap-source/bootstrap-3.0.3/Gruntfile.js Sat Jan 18 12:34:36 2014 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,337 +0,0 @@
1.4 -/* jshint node: true */
1.5 -
1.6 -module.exports = function(grunt) {
1.7 - "use strict";
1.8 -
1.9 - // Force use of Unix newlines
1.10 - grunt.util.linefeed = '\n';
1.11 -
1.12 - RegExp.quote = require('regexp-quote')
1.13 - var btoa = require('btoa')
1.14 - // Project configuration.
1.15 - grunt.initConfig({
1.16 -
1.17 - // Metadata.
1.18 - pkg: grunt.file.readJSON('package.json'),
1.19 - banner: '/*!\n' +
1.20 - ' * Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
1.21 - ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
1.22 - ' * Licensed under <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
1.23 - ' */\n\n',
1.24 - jqueryCheck: 'if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") }\n\n',
1.25 -
1.26 - // Task configuration.
1.27 - clean: {
1.28 - dist: ['dist']
1.29 - },
1.30 -
1.31 - jshint: {
1.32 - options: {
1.33 - jshintrc: 'js/.jshintrc'
1.34 - },
1.35 - gruntfile: {
1.36 - src: 'Gruntfile.js'
1.37 - },
1.38 - src: {
1.39 - src: ['js/*.js']
1.40 - },
1.41 - test: {
1.42 - src: ['js/tests/unit/*.js']
1.43 - }
1.44 - },
1.45 -
1.46 - concat: {
1.47 - options: {
1.48 - banner: '<%= banner %><%= jqueryCheck %>',
1.49 - stripBanners: false
1.50 - },
1.51 - bootstrap: {
1.52 - src: [
1.53 - 'js/transition.js',
1.54 - 'js/alert.js',
1.55 - 'js/button.js',
1.56 - 'js/carousel.js',
1.57 - 'js/collapse.js',
1.58 - 'js/dropdown.js',
1.59 - 'js/modal.js',
1.60 - 'js/tooltip.js',
1.61 - 'js/popover.js',
1.62 - 'js/scrollspy.js',
1.63 - 'js/tab.js',
1.64 - 'js/affix.js'
1.65 - ],
1.66 - dest: 'dist/js/<%= pkg.name %>.js'
1.67 - }
1.68 - },
1.69 -
1.70 - uglify: {
1.71 - options: {
1.72 - banner: '<%= banner %>',
1.73 - report: 'min'
1.74 - },
1.75 - bootstrap: {
1.76 - src: ['<%= concat.bootstrap.dest %>'],
1.77 - dest: 'dist/js/<%= pkg.name %>.min.js'
1.78 - }
1.79 - },
1.80 -
1.81 - recess: {
1.82 - options: {
1.83 - compile: true,
1.84 - banner: '<%= banner %>'
1.85 - },
1.86 - bootstrap: {
1.87 - src: ['less/bootstrap.less'],
1.88 - dest: 'dist/css/<%= pkg.name %>.css'
1.89 - },
1.90 - min: {
1.91 - options: {
1.92 - compress: true
1.93 - },
1.94 - src: ['less/bootstrap.less'],
1.95 - dest: 'dist/css/<%= pkg.name %>.min.css'
1.96 - },
1.97 - theme: {
1.98 - src: ['less/theme.less'],
1.99 - dest: 'dist/css/<%= pkg.name %>-theme.css'
1.100 - },
1.101 - theme_min: {
1.102 - options: {
1.103 - compress: true
1.104 - },
1.105 - src: ['less/theme.less'],
1.106 - dest: 'dist/css/<%= pkg.name %>-theme.min.css'
1.107 - }
1.108 - },
1.109 -
1.110 - copy: {
1.111 - fonts: {
1.112 - expand: true,
1.113 - src: ["fonts/*"],
1.114 - dest: 'dist/'
1.115 - }
1.116 - },
1.117 -
1.118 - qunit: {
1.119 - options: {
1.120 - inject: 'js/tests/unit/phantom.js'
1.121 - },
1.122 - files: ['js/tests/*.html']
1.123 - },
1.124 -
1.125 - connect: {
1.126 - server: {
1.127 - options: {
1.128 - port: 3000,
1.129 - base: '.'
1.130 - }
1.131 - }
1.132 - },
1.133 -
1.134 - jekyll: {
1.135 - docs: {}
1.136 - },
1.137 -
1.138 - validation: {
1.139 - options: {
1.140 - reset: true,
1.141 - relaxerror: [
1.142 - "Bad value X-UA-Compatible for attribute http-equiv on element meta.",
1.143 - "Element img is missing required attribute src."
1.144 - ]
1.145 - },
1.146 - files: {
1.147 - src: ["_gh_pages/**/*.html"]
1.148 - }
1.149 - },
1.150 -
1.151 - watch: {
1.152 - src: {
1.153 - files: '<%= jshint.src.src %>',
1.154 - tasks: ['jshint:src', 'qunit']
1.155 - },
1.156 - test: {
1.157 - files: '<%= jshint.test.src %>',
1.158 - tasks: ['jshint:test', 'qunit']
1.159 - },
1.160 - recess: {
1.161 - files: 'less/*.less',
1.162 - tasks: ['recess']
1.163 - }
1.164 - },
1.165 -
1.166 - sed: {
1.167 - versionNumber: {
1.168 - pattern: (function () {
1.169 - var old = grunt.option('oldver')
1.170 - return old ? RegExp.quote(old) : old
1.171 - })(),
1.172 - replacement: grunt.option('newver'),
1.173 - recursive: true
1.174 - }
1.175 - },
1.176 -
1.177 - 'saucelabs-qunit': {
1.178 - all: {
1.179 - options: {
1.180 - build: process.env.TRAVIS_JOB_ID,
1.181 - concurrency: 3,
1.182 - urls: ['http://127.0.0.1:3000/js/tests/index.html'],
1.183 - browsers: [
1.184 - // See https://saucelabs.com/docs/platforms/webdriver
1.185 - {
1.186 - browserName: 'safari',
1.187 - version: '6',
1.188 - platform: 'OS X 10.8'
1.189 - },
1.190 - {
1.191 - browserName: 'chrome',
1.192 - version: '28',
1.193 - platform: 'OS X 10.6'
1.194 - },
1.195 - /* FIXME: currently fails 1 tooltip test
1.196 - {
1.197 - browserName: 'firefox',
1.198 - version: '25',
1.199 - platform: 'OS X 10.6'
1.200 - },*/
1.201 - // Mac Opera not currently supported by Sauce Labs
1.202 - /* FIXME: currently fails 1 tooltip test
1.203 - {
1.204 - browserName: 'internet explorer',
1.205 - version: '11',
1.206 - platform: 'Windows 8.1'
1.207 - },*/
1.208 - /*
1.209 - {
1.210 - browserName: 'internet explorer',
1.211 - version: '10',
1.212 - platform: 'Windows 8'
1.213 - },
1.214 - {
1.215 - browserName: 'internet explorer',
1.216 - version: '9',
1.217 - platform: 'Windows 7'
1.218 - },
1.219 - {
1.220 - browserName: 'internet explorer',
1.221 - version: '8',
1.222 - platform: 'Windows 7'
1.223 - },
1.224 - {// unofficial
1.225 - browserName: 'internet explorer',
1.226 - version: '7',
1.227 - platform: 'Windows XP'
1.228 - },
1.229 - */
1.230 - {
1.231 - browserName: 'chrome',
1.232 - version: '31',
1.233 - platform: 'Windows 8.1'
1.234 - },
1.235 - {
1.236 - browserName: 'firefox',
1.237 - version: '25',
1.238 - platform: 'Windows 8.1'
1.239 - },
1.240 - // Win Opera 15+ not currently supported by Sauce Labs
1.241 - {
1.242 - browserName: 'iphone',
1.243 - version: '6.1',
1.244 - platform: 'OS X 10.8'
1.245 - },
1.246 - // iOS Chrome not currently supported by Sauce Labs
1.247 - // Linux (unofficial)
1.248 - {
1.249 - browserName: 'chrome',
1.250 - version: '30',
1.251 - platform: 'Linux'
1.252 - },
1.253 - {
1.254 - browserName: 'firefox',
1.255 - version: '25',
1.256 - platform: 'Linux'
1.257 - }
1.258 - // Android Chrome not currently supported by Sauce Labs
1.259 - /* Android Browser (super-unofficial)
1.260 - {
1.261 - browserName: 'android',
1.262 - version: '4.0',
1.263 - platform: 'Linux'
1.264 - }
1.265 - */
1.266 - ],
1.267 - }
1.268 - }
1.269 - }
1.270 - });
1.271 -
1.272 -
1.273 - // These plugins provide necessary tasks.
1.274 - grunt.loadNpmTasks('grunt-contrib-clean');
1.275 - grunt.loadNpmTasks('grunt-contrib-concat');
1.276 - grunt.loadNpmTasks('grunt-contrib-connect');
1.277 - grunt.loadNpmTasks('grunt-contrib-copy');
1.278 - grunt.loadNpmTasks('grunt-contrib-jshint');
1.279 - grunt.loadNpmTasks('grunt-contrib-qunit');
1.280 - grunt.loadNpmTasks('grunt-contrib-uglify');
1.281 - grunt.loadNpmTasks('grunt-contrib-watch');
1.282 - grunt.loadNpmTasks('grunt-html-validation');
1.283 - grunt.loadNpmTasks('grunt-jekyll');
1.284 - grunt.loadNpmTasks('grunt-recess');
1.285 - grunt.loadNpmTasks('grunt-saucelabs');
1.286 - grunt.loadNpmTasks('grunt-sed');
1.287 -
1.288 - // Docs HTML validation task
1.289 - grunt.registerTask('validate-html', ['jekyll', 'validation']);
1.290 -
1.291 - // Test task.
1.292 - var testSubtasks = ['dist-css', 'jshint', 'qunit', 'validate-html'];
1.293 - // Only run Sauce Labs tests if there's a Sauce access key
1.294 - if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined') {
1.295 - testSubtasks.push('connect');
1.296 - testSubtasks.push('saucelabs-qunit');
1.297 - }
1.298 - grunt.registerTask('test', testSubtasks);
1.299 -
1.300 - // JS distribution task.
1.301 - grunt.registerTask('dist-js', ['concat', 'uglify']);
1.302 -
1.303 - // CSS distribution task.
1.304 - grunt.registerTask('dist-css', ['recess']);
1.305 -
1.306 - // Fonts distribution task.
1.307 - grunt.registerTask('dist-fonts', ['copy']);
1.308 -
1.309 - // Full distribution task.
1.310 - grunt.registerTask('dist', ['clean', 'dist-css', 'dist-fonts', 'dist-js']);
1.311 -
1.312 - // Default task.
1.313 - grunt.registerTask('default', ['test', 'dist', 'build-customizer']);
1.314 -
1.315 - // Version numbering task.
1.316 - // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
1.317 - // This can be overzealous, so its changes should always be manually reviewed!
1.318 - grunt.registerTask('change-version-number', ['sed']);
1.319 -
1.320 - // task for building customizer
1.321 - grunt.registerTask('build-customizer', 'Add scripts/less files to customizer.', function () {
1.322 - var fs = require('fs')
1.323 -
1.324 - function getFiles(type) {
1.325 - var files = {}
1.326 - fs.readdirSync(type)
1.327 - .filter(function (path) {
1.328 - return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path)
1.329 - })
1.330 - .forEach(function (path) {
1.331 - var fullPath = type + '/' + path
1.332 - return files[path] = (type == 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8'))
1.333 - })
1.334 - return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'
1.335 - }
1.336 -
1.337 - var files = getFiles('js') + getFiles('less') + getFiles('fonts')
1.338 - fs.writeFileSync('docs-assets/js/raw-files.js', files)
1.339 - });
1.340 -};