Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs-assets: concatenate and minify all docs files. #11977

Merged
merged 6 commits into from
Jan 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 39 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ module.exports = function (grunt) {
' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n' +
' */\n',
jqueryCheck: 'if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") }\n\n',
bannerDocs: '/*!\n' +
' * Bootstrap Docs (<%= pkg.homepage %>)\n' +
' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under the Creative Commons Attribution 3.0 Unported License. For\n' +
' * details, see http://creativecommons.org/licenses/by/3.0/.\n' +
' */\n',
jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap requires jQuery\') }\n\n',

// Task configuration.
clean: {
Expand Down Expand Up @@ -104,30 +110,37 @@ module.exports = function (grunt) {
uglify: {
bootstrap: {
options: {
banner: '<%= banner %>\n',
banner: '<%= banner %>',
report: 'min'
},
src: ['<%= concat.bootstrap.dest %>'],
dest: 'dist/js/<%= pkg.name %>.min.js'
},
customize: {
options: {
banner: '/*!\n' +
' * Bootstrap Docs (<%= pkg.homepage %>)\n' +
' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under the Creative Commons Attribution 3.0 Unported License. For\n' +
' * details, see http://creativecommons.org/licenses/by/3.0/.\n' +
' */\n',
banner: '<%= bannerDocs %>',
report: 'min'
},
src: [
'docs/assets/js/less.js',
'docs/assets/js/jszip.js',
'docs/assets/js/uglify.js',
'docs/assets/js/filesaver.js',
'docs/assets/js/raw-files.js',
'docs/assets/js/customizer.js'
],
dest: 'docs/assets/js/customize.min.js'
},
docsJs: {
options: {
banner: '<%= bannerDocs %>',
report: 'min'
},
src: [
'docs/assets/js/holder.js',
'docs/assets/js/application.js'
],
dest: 'docs/assets/js/docs.min.js'
}
},

Expand Down Expand Up @@ -168,6 +181,23 @@ module.exports = function (grunt) {
}
},

cssmin: {
compress: {
options: {
banner: '<%= bannerDocs %>',
keepSpecialComments: '*',
noAdvanced: true, // turn advanced optimizations off until it's fixed in clean-css
report: 'min',
selectorsMergeMode: 'ie8'
},
src: [
'docs/assets/css/docs.css',
'docs/assets/css/pygments-manni.css'
],
dest: 'docs/assets/css/pack.min.css'
}
},

usebanner: {
dist: {
options: {
Expand Down Expand Up @@ -319,7 +349,7 @@ module.exports = function (grunt) {
grunt.registerTask('dist-js', ['concat', 'uglify']);

// CSS distribution task.
grunt.registerTask('dist-css', ['less', 'csscomb', 'usebanner']);
grunt.registerTask('dist-css', ['less', 'cssmin', 'csscomb', 'usebanner']);

// Docs distribution task.
grunt.registerTask('dist-docs', ['copy:docs']);
Expand Down
2 changes: 1 addition & 1 deletion dist/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/

if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") }
if (typeof jQuery === 'undefined') { throw new Error('Bootstrap requires jQuery') }

/* ========================================================================
* Bootstrap: transition.js v3.0.3
Expand Down
1 change: 0 additions & 1 deletion dist/js/bootstrap.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions docs/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="{{ site.baseurl }}dist/js/bootstrap.min.js"></script>

<script src="{{ site.baseurl }}assets/js/holder.js"></script>
<script src="{{ site.baseurl }}assets/js/application.js"></script>

<script src="{{ site.baseurl }}assets/js/docs.min.js"></script>
{% if page.slug == "customize" %}
<script src="{{ site.baseurl }}assets/js/raw-files.js"></script>
<script src="{{ site.baseurl }}assets/js/customize.min.js"></script>
{% endif %}

Expand Down
3 changes: 1 addition & 2 deletions docs/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<link href="{{ site.baseurl }}dist/css/bootstrap.min.css" rel="stylesheet">

<!-- Documentation extras -->
<link href="{{ site.baseurl }}assets/css/docs.css" rel="stylesheet">
<link href="{{ site.baseurl }}assets/css/pygments-manni.css" rel="stylesheet">
<link href="{{ site.baseurl }}assets/css/pack.min.css" rel="stylesheet">
<!--[if lt IE 9]><script src="{{ site.baseurl }}assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
Expand Down
13 changes: 13 additions & 0 deletions docs/assets/css/pack.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/assets/js/customize.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/assets/js/docs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"grunt-contrib-connect": "~0.6.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-csslint": "~0.2.0",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-less": "~0.9.0",
"grunt-contrib-qunit": "~0.3.0",
Expand Down