forked from angular-ui/bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 5
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 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 angular-ui#2960 Fixes angular-ui#2847 Fixes angular-ui#2625 Fixes angular-ui#2489 Fixes angular-ui#2357 Fixes angular-ui#2176
- 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.'); | ||
}; |