diff --git a/.gitignore b/.gitignore index b6695270f9cff43d34873e6b3597b72bc3f1a4df..70eb458983ac168d5f566e6ce8677c2b89607f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ _SpecRunner.html bkp css/discovery.css css/mirador.css +css/jquery-ui-scoped.css dev.html discovery.html js/discovery diff --git a/Gruntfile.js b/Gruntfile.js index 60d1f7533245498876d475107250efbb1ceb05bd..bafe2c97d717ee25886f20268a5ff9e9834cfcd4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,6 +13,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-githooks'); + grunt.loadNpmTasks('grunt-css-selectors'); // ---------- var distribution = 'build/mirador/mirador.js', @@ -94,7 +95,7 @@ module.exports = function(grunt) { 'css/bootstrap.modals.css', 'css/normalize.css', 'node_modules/font-awesome/css/font-awesome.min.css', - 'css/jquery-ui.min.css', + 'css/jquery-ui-scoped.css', 'node_modules/jstree/dist/themes/default/style.min.css', 'css/collection-tree-mod.css', 'node_modules/qtip2/dist/jquery.qtip.min.css', @@ -249,6 +250,19 @@ module.exports = function(grunt) { ci: { src: 'reports/coverage/PhantomJS*/lcov.info' } + }, + + css_selectors: { + options: { + mutations: [{ + prefix: '.mirador-container' + }] + }, + your_target: { + files: { + 'css/jquery-ui-scoped.css': ['css/jquery-ui.min.css'] + } + } } }); @@ -268,15 +282,20 @@ module.exports = function(grunt) { // Lint task grunt.registerTask('lint', ['jshint', 'eslint']); + // ---------- + // jQueryUI CSS task. + // Scopes all jQueryUI CSS selectors with '.mirador-container'. + grunt.registerTask('jqueryui_css', ['css_selectors']); + // ---------- // Build task. // Cleans out the build folder and builds the code and images into it, checking lint. - grunt.registerTask('build', [ 'clean:build', 'git-describe', 'lint', 'less', 'concat', 'uglify', 'cssmin', 'copy']); + grunt.registerTask('build', [ 'clean:build', 'git-describe', 'lint', 'less', 'jqueryui_css', 'concat', 'uglify', 'cssmin', 'copy']); // ---------- // Dev Build task. // Build, but skip the time-consuming and obscurantist minification and uglification. - grunt.registerTask('dev_build', [ 'clean:build', 'git-describe', 'lint', 'less', 'concat', 'copy']); + grunt.registerTask('dev_build', [ 'clean:build', 'git-describe', 'lint', 'less', 'jqueryui_css', 'concat', 'copy']); // ---------- // Default task. diff --git a/package.json b/package.json index 460279e4cd440d96430b25dee3ea0e27f7e10473..929e59f379186b063ad0154ffd4e202f75cb2461 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "grunt-contrib-less": "^1.4.0", "grunt-contrib-uglify": "*", "grunt-contrib-watch": "*", + "grunt-css-selectors": "^1.3.0", "grunt-git-describe": "*", "grunt-githooks": "^0.3.1", "grunt-template-jasmine-istanbul": "^0.3.3",