]>
git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/Gruntfile.js
2 * Bootstrap's Gruntfile
3 * https://getbootstrap.com
4 * Copyright 2013-2017 The Bootstrap Authors
5 * Copyright 2013-2017 Twitter, Inc.
6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
9 module
. exports = function ( grunt
) {
12 // Force use of Unix newlines
13 grunt
. util
. linefeed
= ' \n '
15 RegExp
. quote = function ( string
) {
16 return string
. replace ( /[-\\^$*+?.()|[\]{}]/g , ' \\ $&' )
19 var path
= require ( 'path' )
20 var isTravis
= require ( 'is-travis' )
22 var configBridge
= grunt
. file
. readJSON ( './grunt/configBridge.json' , { encoding
: 'utf8' })
24 Object
. keys ( configBridge
. paths
). forEach ( function ( key
) {
25 configBridge
. paths
[ key
]. forEach ( function ( val
, i
, arr
) {
26 arr
[ i
] = path
. join ( './docs' , val
)
30 // Project configuration.
34 pkg
: grunt
. file
. readJSON ( 'package.json' ),
36 ' * Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>) \n ' +
37 ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %> \n ' +
38 ' * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) \n ' +
40 jqueryCheck
: 'if (typeof jQuery === \' undefined \' ) { \n ' +
41 ' throw new Error( \' Bootstrap \\\' s JavaScript requires jQuery. jQuery must be included before Bootstrap \\\' s JavaScript. \' ) \n ' +
43 jqueryVersionCheck
: '+function ($) { \n ' +
44 ' var version = $.fn.jquery.split( \' \' )[0].split( \' . \' ) \n ' +
45 ' if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) { \n ' +
46 ' throw new Error( \' Bootstrap \\\' s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0 \' ) \n ' +
50 // Task configuration.
56 // JS build configuration
63 'js/dist/util.js' : 'js/src/util.js' ,
64 'js/dist/alert.js' : 'js/src/alert.js' ,
65 'js/dist/button.js' : 'js/src/button.js' ,
66 'js/dist/carousel.js' : 'js/src/carousel.js' ,
67 'js/dist/collapse.js' : 'js/src/collapse.js' ,
68 'js/dist/dropdown.js' : 'js/src/dropdown.js' ,
69 'js/dist/modal.js' : 'js/src/modal.js' ,
70 'js/dist/scrollspy.js' : 'js/src/scrollspy.js' ,
71 'js/dist/tab.js' : 'js/src/tab.js' ,
72 'js/dist/tooltip.js' : 'js/src/tooltip.js' ,
73 'js/dist/popover.js' : 'js/src/popover.js'
78 extends : '../../js/.babelrc'
81 '<%= concat.bootstrap.dest %>' : '<%= concat.bootstrap.dest %>'
88 banner
: '<%= banner %> \n <%= jqueryCheck %> \n <%= jqueryVersionCheck %> \n +function () { \n ' ,
93 src
: '<%= concat.bootstrap.dest %>'
100 // Custom function to remove all export and import statements
101 process : function ( src
) {
102 return src
. replace ( /^(export|import).*/gm , '' )
110 'js/src/carousel.js' ,
111 'js/src/collapse.js' ,
112 'js/src/dropdown.js' ,
114 'js/src/scrollspy.js' ,
119 dest
: 'dist/js/<%= pkg.name %>.js'
125 inject
: 'js/tests/unit/phantom.js'
127 files
: 'js/tests/index.html'
130 // CSS build configuration
154 config
: '_config.yml' ,
168 'Attribute “autocomplete” is only allowed when the input type is “color”, “date”, “datetime”, “datetime-local”, “email”, “hidden”, “month”, “number”, “password”, “range”, “search”, “tel”, “text”, “time”, “url”, or “week”.' ,
169 'Attribute “autocomplete” not allowed on element “button” at this point.' ,
170 'Consider using the “h1” element as a top-level heading only (all “h1” elements are treated as top-level headings by many screen readers and other tools).' ,
171 'Element “div” not allowed as child of element “progress” in this context. (Suppressing further errors from this subtree.)' ,
172 'Element “img” is missing required attribute “src”.' ,
173 'The “color” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' ,
174 'The “date” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' ,
175 'The “datetime” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' ,
176 'The “datetime-local” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' ,
177 'The “month” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' ,
178 'The “time” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.' ,
179 'The “week” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.'
182 src
: [ '_gh_pages/**/*.html' , 'js/tests/visual/*.html' ]
187 files
: '<%= concat.bootstrap.src %>' ,
191 files
: 'scss/**/*.scss' ,
192 tasks
: [ 'dist-css' , 'docs' ]
195 files
: 'docs/assets/scss/**/*.scss' ,
196 tasks
: [ 'dist-css' , 'docs' ]
203 build
: process
. env
. TRAVIS_JOB_ID
,
207 urls
: [ 'http://127.0.0.1:3000/js/tests/index.html?hidepassed' ],
208 browsers
: grunt
. file
. readYAML ( 'grunt/sauce_browsers.yml' )
215 command
: 'npm run clean-css'
218 command
: 'npm run clean-css-docs'
221 command
: 'npm run postcss'
224 command
: 'npm run postcss-docs'
227 command
: 'npm run htmlhint'
230 command
: 'npm run sass'
233 command
: 'npm run sass-docs'
236 command
: 'npm run scss-lint'
239 command
: 'npm run scss-lint-docs'
242 command
: 'npm run uglify'
245 command
: 'npm run uglify-docs'
254 message
: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
258 remote
: 'git@github.com:twbs/derpstrap.git' ,
267 archive
: 'bootstrap-<%= pkg.version %>-dist.zip' ,
277 dest
: 'bootstrap-<%= pkg.version %>-dist'
286 // These plugins provide necessary tasks.
287 require ( 'load-grunt-tasks' )( grunt
)
288 require ( 'time-grunt' )( grunt
)
290 // Docs HTML validation task
291 grunt
. registerTask ( 'validate-html' , [ 'jekyll:docs' , 'htmllint' , 'exec:htmlhint' ])
293 var runSubset = function ( subset
) {
294 return ! process
. env
. TWBS_TEST
|| process
. env
. TWBS_TEST
=== subset
296 var isUndefOrNonZero = function ( val
) {
297 return val
=== undefined || val
!== '0'
301 var testSubtasks
= []
302 // Skip core tests if running a different subset of the test suite
303 if ( runSubset ( 'core' ) &&
304 // Skip core tests if this is a Savage build
305 process
. env
. TRAVIS_REPO_SLUG
!== 'twbs-savage/bootstrap' ) {
306 testSubtasks
= testSubtasks
. concat ([ 'dist-css' , 'dist-js' , 'test-scss' , 'qunit' , 'docs' ])
308 // Skip HTML validation if running a different subset of the test suite
309 if ( runSubset ( 'validate-html' ) &&
311 // Skip HTML5 validator when [skip validator] is in the commit message
312 isUndefOrNonZero ( process
. env
. TWBS_DO_VALIDATOR
)) {
313 testSubtasks
. push ( 'validate-html' )
315 // Only run Sauce Labs tests if there's a Sauce access key
316 if ( typeof process
. env
. SAUCE_ACCESS_KEY
!== 'undefined' &&
317 // Skip Sauce if running a different subset of the test suite
318 runSubset ( 'sauce-js-unit' )) {
319 testSubtasks
= testSubtasks
. concat ([ 'dist' , 'docs-css' , 'docs-js' , 'clean:docs' , 'copy:docs' ])
320 // Skip Sauce on Travis when [skip sauce] is in the commit message
321 if ( isUndefOrNonZero ( process
. env
. TWBS_DO_SAUCE
)) {
322 testSubtasks
. push ( 'connect' )
323 testSubtasks
. push ( 'saucelabs-qunit' )
326 grunt
. registerTask ( 'test' , testSubtasks
)
328 // JS distribution task.
329 grunt
. registerTask ( 'dist-js' , [ 'babel:dev' , 'concat' , 'babel:dist' , 'stamp' , 'exec:uglify' ])
331 grunt
. registerTask ( 'test-scss' , [ 'exec:scss-lint' ])
333 // CSS distribution task.
334 grunt
. registerTask ( 'sass-compile' , [ 'exec:sass' , 'exec:sass-docs' ])
336 grunt
. registerTask ( 'dist-css' , [ 'sass-compile' , 'exec:postcss' , 'exec:clean-css' , 'exec:clean-css-docs' ])
338 // Full distribution task.
339 grunt
. registerTask ( 'dist' , [ 'clean:dist' , 'dist-css' , 'dist-js' ])
342 grunt
. registerTask ( 'default' , [ 'clean:dist' , 'test' ])
345 grunt
. registerTask ( 'docs-css' , [ 'exec:clean-css-docs' , 'exec:postcss-docs' ])
346 grunt
. registerTask ( 'lint-docs-css' , [ 'exec:scss-lint-docs' ])
347 grunt
. registerTask ( 'docs-js' , [ 'exec:uglify-docs' ])
348 grunt
. registerTask ( 'docs' , [ 'lint-docs-css' , 'docs-css' , 'docs-js' , 'clean:docs' , 'copy:docs' ])
349 grunt
. registerTask ( 'docs-github' , [ 'jekyll:github' ])
351 grunt
. registerTask ( 'prep-release' , [ 'dist' , 'docs' , 'docs-github' , 'compress' ])
354 grunt
. registerTask ( 'publish' , [ 'buildcontrol:pages' ])