UNPKG

causeway-standard-theme

Version:

535 lines (507 loc) 18.6 kB
/* jshint node: true */ module.exports = function (grunt) { "use strict"; // load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns require('load-grunt-tasks')(grunt); // Project configuration. grunt.config.init({ // Metadata. pkg: grunt.file.readJSON('package.json'), banner: '/*!\n' + '*********************************************************************************************\n' + '* <%= pkg.name %> v<%= pkg.version %>\n' + '* Copyright 1998-<%= grunt.template.today("yyyy") %> <%= pkg.company %>.\n' + '* Author: <%= pkg.author %>\n' + '*********************************************************************************************\n' + '*/\n', bootstrap_banner: '/*!\n' + '* <%= pkg.bootstrap.name %> v<%= pkg.bootstrap.version %> (<%= pkg.bootstrap.url %>)\n' + '* Copyright 2011-<%= grunt.template.today("yyyy") %> Twitter, Inc.\n' + '* <%= pkg.bootstrap.license %>\n' + '*/\n', jquery_banner: '/*!\n' + '* <%= pkg.jquery.name %> v<%= pkg.jquery.version %>\n' + '* <%= pkg.jquery.url %>\n' + '*\n' + '* <%= pkg.jquery.includes.sizzle.name %>\n' + '* <%= pkg.jquery.includes.sizzle.url %>\n' + '*\n' + '* <%= pkg.jquery.copyright %>\n' + '* <%= pkg.jquery.license.type %>\n' + '* <%= pkg.jquery.license.url %>\n' + '*\n' + '* <%= pkg.jquery.date %>\n' + '*/\n', bootstrap_file_name: '<%= pkg.bootstrap.name.toLowerCase() %>', cs_js_path: './causeway/js/components', cs_js_responsive_path: './causeway/js/responsive', cs_js_vendors_path: './causeway/js/vendors', cs_img_path: './causeway/images', cs_dist_path: './dist', cs_bower_path: './bower_components', // Task configuration. clean: { dist: { src: [ 'dist/*', '!dist/downloads/**', '!dist/release-notes/**', '!dist/archive/**' ] } }, jshint: { options: { browser: true, globals: { jQuery: true } }, src: { src: ['<%= cs_js_path %>/*.js', './causeway/docs/js' ] } }, concat: { jquery: { src: '<%= cs_bower_path %>/jquery/dist/jquery.js', dest: '<%= cs_dist_path %>/js/jquery.js' }, bootstrap: { options: { banner: '<%= bootstrap_banner %>' }, src: [ '<%= cs_bower_path %>/bootstrap/js/transition.js', '<%= cs_bower_path %>/bootstrap/js/alert.js', '<%= cs_bower_path %>/bootstrap/js/button.js', '<%= cs_bower_path %>/bootstrap/js/carousel.js', '<%= cs_bower_path %>/bootstrap/js/collapse.js', '<%= cs_bower_path %>/bootstrap/js/dropdown.js', '<%= cs_bower_path %>/bootstrap/js/modal.js', '<%= cs_bower_path %>/bootstrap/js/tooltip.js', '<%= cs_bower_path %>/bootstrap/js/popover.js', '<%= cs_bower_path %>/bootstrap/js/scrollspy.js', '<%= cs_bower_path %>/bootstrap/js/tab.js', '<%= cs_bower_path %>/bootstrap/js/affix.js' ], dest: '<%= cs_dist_path %>/js/<%= bootstrap_file_name %>.js' }, causeway_utils: { options: { banner: '<%= banner %>' }, src: [ '<%= cs_bower_path %>/bootstrap-datepicker/dist/js/bootstrap-datepicker.js', '<%= cs_bower_path %>/bootstrap-duallistbox/dist/jquery.bootstrap-duallistbox.js', '<%= cs_bower_path %>/bootstrap-select/dist/js/bootstrap-select.js', '<%= cs_bower_path %>/bootstrap-spinedit/js/bootstrap-spinedit.js', '<%= cs_js_vendors_path %>/bootstrap-timepicker-gh-pages/js/bootstrap-timepicker.js', '<%= cs_js_vendors_path %>/jquery.jqtree/tree.jquery.js', '<%= cs_js_vendors_path %>/jquery.scrollbar/jquery.scrollbar.js', '<%= cs_js_vendors_path %>/jquery.tablesorter/jquery.tablesorter.js', '<%= cs_js_vendors_path %>/jquery.treegrid/jquery.treegrid.js', '<%= cs_js_vendors_path %>/jquery-simple-color-master/jquery.simple-color.js', '<%= cs_js_vendors_path %>/jquery.placeholder.js', '<%= cs_bower_path %>/bootstrap-hover-dropdown/bootstrap-hover-dropdown.js', '<%= cs_js_vendors_path %>/jquery.fixedtable/jquery.fixedTblHdrLftCol-min.js', '<%= cs_js_vendors_path %>/tableHeadFixer.js' ], dest: '<%= cs_dist_path %>/js/causeway-utils.js' }, causeway_utils_css: { options: { banner: '<%= banner %>', keepSpecialComments: 0 }, src: [ '<%= cs_bower_path %>/bootstrap-select/dist/css/bootstrap-select.css', '<%= cs_bower_path %>/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css', '<%= cs_js_vendors_path %>/bootstrap-timepicker-gh-pages/css/bootstrap-timepicker.css', '<%= cs_js_vendors_path %>/jquery.scrollbar/jquery.scrollbar.css', '<%= cs_js_vendors_path %>/jquery.treegrid/jquery.treegrid.css', '<%= cs_bower_path %>/bootstrap-spinedit/css/bootstrap-spinedit.css', '<%= cs_bower_path %>/bootstrap-duallistbox/dist/bootstrap-duallistbox.css', '<%= cs_js_vendors_path %>/jquery.jqtree/jqtree.css', 'causeway/causeway-utils.less' ], dest: '<%= cs_dist_path %>/css/causeway-utils.css' }, causeway_js: { options: { banner: '<%= banner %>' }, src: [ '<%= cs_js_path %>/global.js', '<%= cs_js_path %>/causeway.js', '<%= cs_js_path %>/left-shell-navigation.js', '<%= cs_js_path %>/lightbox.js', '<%= cs_js_path %>/tables.js', '<%= cs_js_path %>/tree-list.js', '<%= cs_js_path %>/tree-view.js', '<%= cs_js_path %>/wizard.js' ], dest: '<%= cs_dist_path %>/js/causeway.js' }, responsive_js: { options: { banner: '<%= banner %>' }, src: '<%= cs_js_responsive_path %>/*.js', dest: '<%= cs_dist_path %>/js/responsive.js' }, docs: { options: { banner: '<%= banner %>' }, src: 'causeway/docs/js/docs.js', dest: '<%= cs_dist_path %>/docs/js/docs.js' } }, uglify: { jquery: { options: { banner: '<%= jquery_banner %>' }, src: '<%= concat.jquery.dest %>', dest: '<%= cs_dist_path %>/js/jquery.min.js' }, bootstrap: { options: { banner: '<%= bootstrap_banner %>' }, src: '<%= concat.bootstrap.dest %>', dest: '<%= cs_dist_path %>/js/<%= bootstrap_file_name %>.min.js' }, causeway_utils: { options: { banner: '<%= banner %>' }, src: '<%= concat.causeway_utils.dest %>', dest: '<%= cs_dist_path %>/js/causeway-utils.min.js' }, causeway: { options: { banner: '<%= banner %>' }, src: '<%= concat.causeway_js.dest %>', dest: '<%= cs_dist_path %>/js/causeway.min.js' }, responsive: { options: { banner: '<%= banner %>' }, src: '<%= concat.responsive_js.dest %>', dest: '<%= cs_dist_path %>/js/responsive.min.js' }, docs: { options: { banner: '<%= banner %>' }, src: '<%= concat.docs.dest %>', dest: '<%= cs_dist_path %>/docs/js/docs.min.js' } }, less: { bootstrap: { options: { banner: '<%= bootstrap_banner %>' }, src: './causeway/override/bootstrap.less', dest: '<%= cs_dist_path %>/css/<%= bootstrap_file_name %>.css' }, bootstrap_min: { options:{ compress: true, yuicompress: true, optimization: 2 }, src: '<%= less.bootstrap.dest %>', dest: '<%= cs_dist_path %>/css/<%= bootstrap_file_name %>.min.css' }, causeway_standard: { options:{ banner: '<%= banner %>' }, src: './causeway/causeway-standard.less', dest: '<%= cs_dist_path %>/css/causeway-standard.css' }, causeway_standard_min: { options:{ compress: true, yuicompress: true, banner: '<%= banner %>', optimization: 2, sourceMap: true, outputSourceFiles: true, sourceMapURL: 'causeway-standard.min.css.map', sourceMapFilename: '<%= cs_dist_path %>/css/causeway-standard.min.css.map' }, src: '<%= less.causeway_standard.src %>', dest: 'dist/css/causeway-standard.min.css' }, causeway_print: { options:{ banner: '<%= banner %>' }, src: './causeway/causeway-print.less', dest: '<%= cs_dist_path %>/css/causeway-print.css' }, causeway_print_min: { options:{ compress: true, yuicompress: true, banner: '<%= banner %>', optimization: 2 }, src: '<%= less.causeway_print.dest %>', dest: '<%= cs_dist_path %>/css/causeway-print.min.css' }, docs: { options:{ banner: '<%= banner %>' }, src: './causeway/docs/less/docs.less', dest: '<%= cs_dist_path %>/docs/css/docs.css' }, docs_min: { options:{ compress: true, yuicompress: true, banner: '<%= banner %>', optimization: 2 }, src: '<%= less.docs.dest %>', dest: '<%= cs_dist_path %>/docs/css/docs.min.css' }, causeway_utils_min: { options:{ compress: true, yuicompress: true }, src: '<%= concat.causeway_utils_css.dest %>', dest: '<%= cs_dist_path %>/css/causeway-utils.min.css' } }, copy: { bootstrap_glyphicons: { expand: true, cwd: '<%= cs_bower_path %>/bootstrap/fonts', src: "**/*", dest: '<%= cs_dist_path %>/fonts' }, font_awesome: { expand: true, cwd: '<%= cs_bower_path %>/font-awesome/fonts', src: "**/*", dest: '<%= cs_dist_path %>/fonts' }, causeway_fonts: { expand: true, cwd: './causeway/fonts', src: "**/*", dest: '<%= cs_dist_path %>/fonts' }, images: { expand: true, cwd: '<%= cs_img_path %>', src: '**/*', dest: '<%= cs_dist_path %>/images' }, package: { src: './package.json', dest: '<%= cs_dist_path %>/package.json' } }, bake: { causeway_html: { options: { // Task-specific options go here. }, files: { // files go here, like so: "dist/index.html": "causeway/index.html", "dist/docs/index.html": "causeway/docs/index.html", "dist/docs/misc.html": "causeway/docs/misc.html", "dist/docs/shells.html": "causeway/docs/shells.html", "dist/docs/content.html": "causeway/docs/shells-content.html", "dist/docs/icons.html": "causeway/docs/shells-content-icons.html", "dist/docs/double-pane.html": "causeway/docs/shells-double-pane.html", "dist/docs/components.html": "causeway/docs/components.html", "dist/docs/buttons.html": "causeway/docs/components-buttons.html", "dist/docs/forms.html": "causeway/docs/components-forms.html", "dist/docs/select.html": "causeway/docs/components-forms-select.html", "dist/docs/date.html": "causeway/docs/components-forms-date.html", "dist/docs/menus.html": "causeway/docs/components-menus.html", "dist/docs/table.html": "causeway/docs/components-table.html", "dist/docs/pagination.html": "causeway/docs/components-pagination.html", "dist/docs/wizard.html": "causeway/docs/components-wizard.html", "dist/docs/print.html": "causeway/docs/print.html", "dist/docs/login.html": "causeway/docs/login.html", "dist/docs/login_new.html": "causeway/docs/login_new.html", "dist/docs/color-palette.html": "causeway/docs/color-palette.html", "dist/docs/login_demo.html": "causeway/docs/login_demo.html", "dist/docs/login_demo2.html": "causeway/docs/login_demo2.html", "dist/docs/login-screen.html": "causeway/docs/login-screen.html", "dist/docs/login_v1.0.6-0.html": "causeway/docs/login_v1.0.6-0.html", "dist/docs/left-navigation.html": "causeway/docs/shells-left-navigation.html", "dist/docs/breadcrumb.html": "causeway/docs/components-breadcrumb.html", "dist/docs/treeview.html": "causeway/docs/components-treeview.html", "dist/docs/treegrid.html": "causeway/docs/components-treegrid.html", "dist/docs/treelist.html": "causeway/docs/components-treelist.html", "dist/docs/treesearchlist.html": "causeway/docs/components-treesearchlist.html", "dist/docs/site-notification.html": "causeway/docs/components-site-notification.html", "dist/docs/status-indicator.html": "causeway/docs/components-status-indicator.html", "dist/docs/twopane-horizontal.html": "causeway/docs/shells-twopane-horizontal.html", "dist/docs/left-navigation-rightpane.html": "causeway/docs/shells-left-navigation-rightpane.html", "dist/docs/twopane-vertical.html": "causeway/docs/shells-twopane-vertical.html", "dist/docs/accordion.html": "causeway/docs/components-accordion.html" } } }, connect: { server: { options: { port: 9000, base: 'dist', livereload: true } } }, watch: { options: { livereload: true }, src: { files: '<%= jshint.src %>', tasks: [ 'jshint' ] }, less: { files: './causeway/**/*.less', tasks: [ 'concat:causeway_utils_css', 'less' ] }, fonts: { files: './causeway/fonts/**', tasks: 'copy' }, images: { files: '<%= cs_img_path %>/**', tasks: 'copy' }, javascript: { files: ['./causeway/js/**/*.js', '<%= cs_bower_path %>/**/*.js'], tasks: [ 'concat:causeway_utils', 'uglify:causeway_utils', 'concat:causeway_js', 'uglify:causeway', 'concat:responsive_js', 'uglify:responsive' ] }, grunt: { files: './Gruntfile.js', tasks: 'dist' }, docs_javascript: { files: './causeway/docs/js/**/*.js', tasks: [ 'jshint', 'concat:docs', 'uglify:docs' ] }, causeway_html: { files: './causeway/**/*.html', tasks: [ 'bake:causeway_html' ] } }, compress: { main: { options: { mode: 'zip', archive: '<%= cs_dist_path %>/downloads/CausewayCSS.dist.v<%= pkg.version %>.zip' }, files: [ { src: [ 'dist/**/*', '!dist/downloads/**', '!dist/application-bar/**', '!dist/archive/**', '!dist/release-notes/**', '!dist/package.json' ] } ] } }, //Changelog changelog: { sample: { options: { dest: '<%= cs_dist_path %>/release-notes/index.html', insertType: 'prepend', featureRegex: /^(UIUX-\d(?!.*(?:fix|fixes|issue|issues)).*)$/igm, fixRegex: /^(.*?\b(?:fix|fixes|issue|issues)\b.*?.*)$/igm, template: '<div class="release-wrapper">\n' + '\t<h3 class="title"><%= pkg.name %>-<%= pkg.version %> <span>[{{date}}]</span></h3>\n' + '\t<a href="downloads/CausewayCSS.dist.v<%= pkg.version %>.zip">Download</a>\n' + '\t<span class="glyphicon glyphicon-tree-minus"></span>\n' + '\t<div class="release-content">\n\t\t<h4>Features</h4>\n' + '\t\t<ul class="features">{{> features}}</ul>\n' + '\t\t<h4>Fixes</h4>\n' + '\t\t<ul class="fixes">{{> fixes}}</ul>\n' + '\t</div>\n' + '</div>\n', partials: { features: '{{#each features}}{{> feature}}{{/each}}', feature: '\n\t\t\t<li>{{this}}</li>', fixes: '{{#each fixes}}{{> fix}}{{/each}}', fix: '\n\t\t\t<li>{{this}}</li>' } } } }, bump: { options: { files: ['package.json'], updateConfigs: [], commit: true, commitMessage: 'Release v%VERSION%', commitFiles: ['package.json'], createTag: true, tagName: 'v%VERSION%', tagMessage: 'Version %VERSION%', push: false, pushTo: '', gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d', globalReplace: false } } }); // JS distribution task. grunt.registerTask('dist-js', ['concat', 'jshint', 'uglify']); // CSS distribution task. grunt.registerTask('dist-css', ['concat:causeway_utils_css', 'less']); // Fonts distribution task. grunt.registerTask('dist-fonts', ['copy:bootstrap_glyphicons', 'copy:font_awesome', 'copy:causeway_fonts']); // Image distribution task. grunt.registerTask('dist-img', ['copy:images']); // HTML distribution task. grunt.registerTask('dist-html', ['bake']); // Package JSON. grunt.registerTask('dist-package', ['copy:package']); // Full distribution task. grunt.registerTask('dist', ['clean', 'dist-css', 'dist-fonts', 'dist-img', 'dist-js', 'dist-html', 'dist-package', 'compress']); // Default task. grunt.registerTask('default', ['dist', 'connect', 'watch']); };