This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): make custom builds on demo site work
Use approach from Twitter Bootstrap. Most of the code is from their customizer. - use modules in mappings file - generate concatenated JS - generate tpl and non-tpl file with banner - generate zip file for custom builds - add browser compatibility message - speed up page by deferring loading of files - only load the files when needed. Cache them after they're loaded. Fixes #2960 Fixes #2847 Fixes #2625 Fixes #2489 Fixes #2357 Fixes #2176 Closes #2892
- Loading branch information
Showing
5 changed files
with
284 additions
and
14 deletions.
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/*! | ||
* Forked from: | ||
* Bootstrap Grunt task for generating raw-files.min.js for the Customizer | ||
* http://getbootstrap.com | ||
* Copyright 2014 Twitter, Inc. | ||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | ||
*/ | ||
|
||
/* jshint node: true */ | ||
|
||
'use strict'; | ||
var fs = require('fs'); | ||
|
||
function getFiles(filePaths) { | ||
var files = {}; | ||
filePaths | ||
.forEach(function (path) { | ||
files[path] = fs.readFileSync(path, 'utf8'); | ||
}); | ||
return files; | ||
} | ||
|
||
module.exports = function generateRawFilesJs(grunt, jsFilename, files, banner) { | ||
if (!banner) { | ||
banner = ''; | ||
} | ||
|
||
var filesJsObject = { | ||
banner: banner, | ||
files: getFiles(files), | ||
}; | ||
|
||
var filesJsContent = JSON.stringify(filesJsObject); | ||
try { | ||
fs.writeFileSync(jsFilename, filesJsContent); | ||
} | ||
catch (err) { | ||
grunt.fail.warn(err); | ||
} | ||
grunt.log.writeln('File ' + jsFilename.cyan + ' created.'); | ||
}; |