- Enable minification for the frontend JS bundle

- Make sure we are pegged to version 3.3.3 of D3
This commit is contained in:
Joseph Schorr 2014-04-15 15:58:00 -04:00
parent 7aab6a9fdd
commit 5fa4733a2f
4 changed files with 17 additions and 4 deletions

View file

@ -120,7 +120,7 @@ def render_page_template(name, **kwargs):
main_styles = ['dist/quay-frontend.css'] main_styles = ['dist/quay-frontend.css']
library_scripts = [] library_scripts = []
main_scripts = ['dist/quay-frontend.js'] main_scripts = ['dist/quay-frontend.min.js']
cache_buster = random_string() cache_buster = random_string()

View file

@ -32,12 +32,24 @@ module.exports = function(grunt) {
cssmin: { cssmin: {
'../static/dist/<%= pkg.name %>.css': ['../static/lib/**/*.css', '../static/css/*.css'] '../static/dist/<%= pkg.name %>.css': ['../static/lib/**/*.css', '../static/css/*.css']
},
uglify: {
options: {
mangle: false
},
js_min: {
files: {
'../static/dist/<%= pkg.name %>.min.js': ['../static/dist/<%= pkg.name %>.js']
}
}
} }
}); });
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task(s). // Default task(s).
grunt.registerTask('default', ['concat', 'cssmin']); grunt.registerTask('default', ['concat', 'cssmin', 'uglify']);
}; };

View file

@ -5,6 +5,7 @@
"grunt": "~0.4.4", "grunt": "~0.4.4",
"grunt-contrib-concat": "~0.4.0", "grunt-contrib-concat": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0", "grunt-contrib-cssmin": "~0.9.0",
"grunt-angular-templates": "~0.5.4" "grunt-angular-templates": "~0.5.4",
"grunt-contrib-uglify": "~0.4.0"
} }
} }

View file

@ -58,7 +58,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.2.1/moment.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.2.1/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.2.0/js/bootstrap-datepicker.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.2.0/js/bootstrap-datepicker.min.js"></script>
<script src="//cdn.jsdelivr.net/g/bootbox@4.1.0,underscorejs@1.5.2,restangular@1.2.0,d3js"></script> <script src="//cdn.jsdelivr.net/g/bootbox@4.1.0,underscorejs@1.5.2,restangular@1.2.0,d3js@3.3.3"></script>
{% for script_path in library_scripts %} {% for script_path in library_scripts %}
<script src="/static/{{ script_path }}?v={{ cache_buster }}"></script> <script src="/static/{{ script_path }}?v={{ cache_buster }}"></script>