<commit_before>/*
	The MIT License (MIT)

	Copyright (c) 2014 Julian Xhokaxhiu

	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to deal
	in the Software without restriction, including without limitation the rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in all
	copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
	SOFTWARE.
*/
module.exports = function(grunt) {

	var extend = require('node.extend'),
    	app = grunt.file.readJSON('app.json'),
        appExists = function(name) {
            var ret = false;
            ret = grunt.file.exists('app/' + name);
            return ret;
        },
        pathExistsInApp = function(path) {
            var ret = false;

            if (grunt.file.exists(app.path + '/tpl/' + path))
                ret = path;

            return ret;
        },
        getResourcePath = function() {
        	return app.path + '/rsc/';
        },
        getFullPath = function(path) {
        	if ( path === undefined ) path = '';
        	else path = path + '/';
            return app.path + '/tpl/' + path;
        },
        getFontsPath = function() {
        	return app.path + '/fonts/';
        },
        getWebFontsPath = function() {
        	return app.path + '/webfonts/';
        },
        getIconsPath = function() {
        	return app.path + '/icons/';
        },
        getWebIconsPath = function() {
        	return app.path + '/webicons/';
        },
        getAppConfig = function() {
            var ret = {
                name: app.name,
                liveReloadHost: app.liveReloadHost,
                cssFiles: {
                    'screen': grunt.file.expand({
                        filter: 'isFile',
                        cwd: getFullPath()
                    }, app.cssPath),
                    'print': grunt.file.expand({
                        filter: 'isFile',
                        cwd: getFullPath()
                    }, app.cssPrintPath)
                },
                jsFiles: [
                	app.jsMin
                ]
            };

            if ( ['build_deploy','deploy'].indexOf(app.command) > -1 ) {
                ret.liveReloadHost = false;
                ret.cssFiles = {
                    'screen': [app.cssMin],
                    'print': [app.cssPrintMin]
                };
                ret.jsFiles = [app.jsMin];
            }

            if ( grunt.file.exists( app.path + '/data.json' ) )
                ret.data = grunt.file.readJSON( app.path + '/data.json' );

            return ret;
        },
        setAppConfig = function(command, config) {
            // Initialize with required data for extension
            app.path = 'app/' + config.name;

            // Extend with app configuration
            if ( grunt.file.exists( app.path + '/config.json' ) )
                app = extend( app, grunt.file.readJSON( app.path + '/config.json' ) );

            // Continue setting our core app data
            app.command = command;
            app.name = config.name;
            app.cssMin = 'css/' + config.name + '.min.css';
            app.cssPath = 'css/**/*.css';
            app.cssMapPath = 'css/**/*.map';
            app.scssPath = 'scss/screen.scss';
            app.cssPrintMin = 'css/' + config.name + '.min.print.css';
            app.cssPrintPath = 'css-print/**/*.css';
            app.cssPrintMapPath = 'css-print/**/*.map';
            app.scssPrintPath = 'scss/print.scss';
            app.jsMin = 'js/' + config.name + '.min.js';
            app.jsPath = 'js/**/*.js';
            app.cssConfigFiles = {}
            app.cssConfigFiles[app.wwwPath + app.cssMin] = [ getFullPath() + app.cssPath ];
            app.cssConfigFiles[app.wwwPath + app.cssPrintMin] = [ getFullPath() + app.cssPrintPath ];
            app.scssConfigFiles = {}
            app.scssConfigFiles[ getFullPath('css') + '99_' + app.name + '.css' ] = [ getFullPath() + app.scssPath ];
            app.scssConfigFiles[ getFullPath('css-print') + '99_' + app.name + '.css' ] = [ getFullPath() + app.scssPrintPath ];
            app.jsExternalLibraries = [
            	'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js'
            ];
            app.jsConfigFiles = {}
            app.jsConfigFiles[ app.wwwPath + app.jsMin ] = app.jsExternalLibraries.concat( [ getFullPath() + app.jsPath ] );
            app.fontConfigFiles = {}
            app.fontConfigFiles[ getWebFontsPath() ] = [
            	getFontsPath() + '*.otf',
				getFontsPath() + '*.ttf'
            ];
            app.webFontConfigFiles = {};
            app.webFontConfigFiles[ getFullPath('css') + '98_webfonts.css' ] = [
            	getWebFontsPath() + '*.css'
            ];
            app.webFontConfigFiles[ getFullPath('css-print') + '98_webfonts.css' ] = [
            	getWebFontsPath() + '*.css'
            ];
            app.iconsConfigFiles = {}
            app.iconsConfigFiles[ getWebIconsPath() ] = [
            	getIconsPath() + '*.svg'
            ];

            // Configure the tasks
            grunt.initConfig({
                pkg: grunt.file.readJSON('package.json'),
                clean: {
                    options: {
                        force: true
                    },
                    www: [
                        app.wwwPath + '*',
                        getFullPath('scss') + '_' + app.name + '-icons.scss'
                    ],
                    mapFiles: [
                    	getFullPath('css') + '/*.map',
                        getFullPath('css-print') + '/*.map',
                    ],
                    webfonts: [
                    	getWebFontsPath()
                    ],
                    webicons: [
                    	getWebIconsPath()
                    ]
                },
                tasty_swig: {
                	options: {
                		context: {
                			app: getAppConfig()
                		}
                	},
                	build: {
						src: [ getFullPath() + '*.swig' ],
						dest: app.wwwPath
					}
                },
				sass: {
					build: {
						files: app.scssConfigFiles
					},
					deploy: {
						files: app.scssConfigFiles
					},
				},
				fontgen: {
					build: {
						options: {
							path_prefix: '../fonts/'
						},
						files: app.fontConfigFiles
					}
				},
				webfont: {
					icons: {
						src: getIconsPath() + '*.svg',
						dest: getWebIconsPath(),
						options: {
                            relativeFontPath: '../fonts/',
							font: app.name + '-icons',
                            stylesheet: 'scss',
                            templateOptions: {
                                baseClass: app.name + '-icon',
                                classPrefix: app.name + '-icon-',
                                mixinPrefix: app.name + '-icon-'
                            }
						}
					}
				},
                concat: {
                	webfonts: {
                		files: app.webFontConfigFiles
                	},
                    css: {
                        filter: 'isFile',
                        src: getFullPath( app.cssPath ),
                        dest: app.wwwPath + app.cssMin
                    },
                    cssPrint: {
                        filter: 'isFile',
                        src: getFullPath( app.cssPrintPath ),
                        dest: app.wwwPath + app.cssPrintMin
                    },
                    js: {
                    	files: app.jsConfigFiles
                    }
                },
                autoprefixer: {
                    options: {
                        browsers: ['last 3 versions', 'bb 10', 'android 3']
                    },
                    build: {
                        src: app.wwwPath + 'css/*.css'
                    },
                },
                cssmin: {
                    build: {
                        files: app.cssConfigFiles
                    }
                },
                closurecompiler: {
                    build: {
                    	files: app.jsConfigFiles,
                    	options: {
			                // Any options supported by Closure Compiler, for example:
			                "compilation_level": "SIMPLE_OPTIMIZATIONS",

			                // Plus a simultaneous processes limit
			                "max_processes": 5,
			            }
                    }
                },
                copy: {
                    build: {
                        files: [
	                        // The project CSS and JS files
	                        {
	                            expand: true,
	                            cwd: getFullPath(),
	                            src: [
	                                app.cssPath,
	                                app.cssPrintPath,
	                                app.cssMapPath,
	                                app.cssPrintMapPath,
	                                app.jsPath
	                            ],
	                            dest: app.wwwPath
	                        },
                            {
                                expand: true,
                                cwd: getWebIconsPath(),
                                src: [
                                    '*.scss'
                                ],
                                dest: getFullPath('scss')
                            }
                        ]
                    },
                    deploy: {
                        files: [
                        	// External Packages Fonts
                        	{
                        		expand: true,
                        		flatten: true,
                        		cwd: 'bower_components/',
                        		src: ['**/*.{ttf,woff,eot,svg,otf}'],
                        		dest: app.wwwPath + '/fonts/'
                        	},
                        	// The project Webfonts
                        	{
                        		expand: true,
                        		flatten: true,
                        		cwd: getWebFontsPath(),
                        		src: ['**/*.{ttf,woff,eot,svg,otf}'],
                        		dest: app.wwwPath + '/fonts/'
                        	},
                        	// The project Webicons
                        	{
                        		expand: true,
                        		flatten: true,
                        		cwd: getWebIconsPath(),
                        		src: ['**/*.{ttf,woff,eot,svg,otf}'],
                        		dest: app.wwwPath + '/fonts/'
                        	},
                        	// Webicons sass generated file
                        	{
                                expand: true,
                                cwd: getWebIconsPath(),
                                src: [
                                    '*.scss'
                                ],
                                dest: getFullPath('scss')
                            },
                        	// The project resource files
	                        {
	                            expand: true,
	                            cwd: getResourcePath(),
	                            src: ['**'],
	                            dest: app.wwwPath
	                        }
                        ]
                    },
                    make: {
                        files: [{
                            expand: true,
                            cwd: '_apptpl/',
                            src: ['**'],
                            dest: app.path
                        }]
                    }
                },
                watch: {
                    html: {
                        options: {
                            livereload: app.liveReloadPort
                        },
                        files: [
                            getFullPath() + '**/*.swig',
                            app.path + '/data.json'
                        ],
                        tasks: [
                        	'rebuild:' + app.name + ':html'
                        ]
                    },
                    css: {
                        options: {
                            livereload: app.liveReloadPort
                        },
                        files: [
                            getFullPath() + '**/*.scss',
                        ],
                        tasks: [
                            'rebuild:' + app.name + ':css'
                        ]
                    },
                    js: {
                        options: {
                            livereload: app.liveReloadPort
                        },
                        files: [
                            getFullPath() + '**/*.js'
                        ],
                        tasks: [
                            'rebuild:' + app.name + ':js'
                        ]
                    }
                },
                rsync: {
                    options: {
                        recursive: true
                    },
                    deploy: {
                        options: {
                            src: app.wwwPath,
                            dest: app.deployPath,
                            host: app.deployHost
                        }
                    }
                }
            });
        };

    // Load Tasks
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-yui-compressor');
    grunt.loadNpmTasks('grunt-closurecompiler');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-tasty-swig');
    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-rsync');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-fontgen');
    grunt.loadNpmTasks('grunt-webfont');

    grunt.registerTask('default', 'Gruntfile for Mockups', function() {
        grunt.warn('No project name specified.\n\nAvailable commands:\n"build:project_name"\n"deploy:project_name"\n"make:project_name"\n');
    });

    grunt.registerTask('build', 'Build a mockup and watch for file modifications', function ( name ) {
        if (appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'rebuild:' + name,
                'watch'
            ]);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('rebuild', 'Build a mockup without watching for file modifications', function ( name, watchTask ) {
        if (appExists(name)) {
            var tasks = [];
            if ( watchTask === undefined ) watchTask = 'all';

            if ( watchTask == 'all' ) {
                tasks = tasks.concat([
                    'clean',
                    'fontgen',
                    'webfont',
                    'concat:webfonts',
                    'copy:build',
                    'sass:build',
                    'autoprefixer',
                    'concat:js',
                    'tasty_swig',
                    'copy:deploy',
                    'clean:mapFiles',
                    'clean:webfonts',
                    'clean:webicons'
                ]);
            } else if ( watchTask == 'html' ) {
                tasks = tasks.concat([
                    'tasty_swig',
                    'copy:deploy',
                    'copy:build'
                ]);
            } else if ( watchTask == 'css' ) {
                tasks = tasks.concat([
                    'sass:build',
                    'autoprefixer',
                    'copy:deploy',
                    'copy:build'
                ]);
            } else if ( watchTask == 'js' ) {
                tasks = tasks.concat([
                    'concat:js',
                    'copy:deploy',
                    'copy:build'
                ]);
            }

            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run(tasks);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('build_deploy', 'Build a mockup ready for deployment sync', function ( name ) {
        if (appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'clean',
                'fontgen',
                'webfont',
                'concat:webfonts',
                'copy:deploy',
                'sass:deploy',
                'concat:css',
                'concat:cssPrint',
                'autoprefixer',
                'cssmin',
                'closurecompiler',
                'tasty_swig',
                'clean:mapFiles',
                'clean:webfonts',
                'clean:webicons'
            ]);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('deploy', 'Deploy a mockup to the Mockups Server', function ( name ) {
    	if (appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'build_deploy:' + name,
                'rsync:deploy'
            ]);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('make', 'Create a new mockup folder based on a template', function ( name ) {
        if (!appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'copy:make'
            ]);
        } else
            grunt.warn('[' + name + '] already exists. Please use another name.\n');
    });
};
<commit_msg>Add sourcemap support for the autoprefixer task.<commit_after>/*
	The MIT License (MIT)

	Copyright (c) 2014 Julian Xhokaxhiu

	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to deal
	in the Software without restriction, including without limitation the rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in all
	copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
	SOFTWARE.
*/
module.exports = function(grunt) {

	var extend = require('node.extend'),
    	app = grunt.file.readJSON('app.json'),
        appExists = function(name) {
            var ret = false;
            ret = grunt.file.exists('app/' + name);
            return ret;
        },
        pathExistsInApp = function(path) {
            var ret = false;

            if (grunt.file.exists(app.path + '/tpl/' + path))
                ret = path;

            return ret;
        },
        getResourcePath = function() {
        	return app.path + '/rsc/';
        },
        getFullPath = function(path) {
        	if ( path === undefined ) path = '';
        	else path = path + '/';
            return app.path + '/tpl/' + path;
        },
        getFontsPath = function() {
        	return app.path + '/fonts/';
        },
        getWebFontsPath = function() {
        	return app.path + '/webfonts/';
        },
        getIconsPath = function() {
        	return app.path + '/icons/';
        },
        getWebIconsPath = function() {
        	return app.path + '/webicons/';
        },
        getAppConfig = function() {
            var ret = {
                name: app.name,
                liveReloadHost: app.liveReloadHost,
                cssFiles: {
                    'screen': grunt.file.expand({
                        filter: 'isFile',
                        cwd: getFullPath()
                    }, app.cssPath),
                    'print': grunt.file.expand({
                        filter: 'isFile',
                        cwd: getFullPath()
                    }, app.cssPrintPath)
                },
                jsFiles: [
                	app.jsMin
                ]
            };

            if ( ['build_deploy','deploy'].indexOf(app.command) > -1 ) {
                ret.liveReloadHost = false;
                ret.cssFiles = {
                    'screen': [app.cssMin],
                    'print': [app.cssPrintMin]
                };
                ret.jsFiles = [app.jsMin];
            }

            if ( grunt.file.exists( app.path + '/data.json' ) )
                ret.data = grunt.file.readJSON( app.path + '/data.json' );

            return ret;
        },
        setAppConfig = function(command, config) {
            // Initialize with required data for extension
            app.path = 'app/' + config.name;

            // Extend with app configuration
            if ( grunt.file.exists( app.path + '/config.json' ) )
                app = extend( app, grunt.file.readJSON( app.path + '/config.json' ) );

            // Continue setting our core app data
            app.command = command;
            app.name = config.name;
            app.cssMin = 'css/' + config.name + '.min.css';
            app.cssPath = 'css/**/*.css';
            app.cssMapPath = 'css/**/*.map';
            app.scssPath = 'scss/screen.scss';
            app.cssPrintMin = 'css/' + config.name + '.min.print.css';
            app.cssPrintPath = 'css-print/**/*.css';
            app.cssPrintMapPath = 'css-print/**/*.map';
            app.scssPrintPath = 'scss/print.scss';
            app.jsMin = 'js/' + config.name + '.min.js';
            app.jsPath = 'js/**/*.js';
            app.cssConfigFiles = {}
            app.cssConfigFiles[app.wwwPath + app.cssMin] = [ getFullPath() + app.cssPath ];
            app.cssConfigFiles[app.wwwPath + app.cssPrintMin] = [ getFullPath() + app.cssPrintPath ];
            app.scssConfigFiles = {}
            app.scssConfigFiles[ getFullPath('css') + '99_' + app.name + '.css' ] = [ getFullPath() + app.scssPath ];
            app.scssConfigFiles[ getFullPath('css-print') + '99_' + app.name + '.css' ] = [ getFullPath() + app.scssPrintPath ];
            app.jsExternalLibraries = [
            	'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js'
            ];
            app.jsConfigFiles = {}
            app.jsConfigFiles[ app.wwwPath + app.jsMin ] = app.jsExternalLibraries.concat( [ getFullPath() + app.jsPath ] );
            app.fontConfigFiles = {}
            app.fontConfigFiles[ getWebFontsPath() ] = [
            	getFontsPath() + '*.otf',
				getFontsPath() + '*.ttf'
            ];
            app.webFontConfigFiles = {};
            app.webFontConfigFiles[ getFullPath('css') + '98_webfonts.css' ] = [
            	getWebFontsPath() + '*.css'
            ];
            app.webFontConfigFiles[ getFullPath('css-print') + '98_webfonts.css' ] = [
            	getWebFontsPath() + '*.css'
            ];
            app.iconsConfigFiles = {}
            app.iconsConfigFiles[ getWebIconsPath() ] = [
            	getIconsPath() + '*.svg'
            ];

            // Configure the tasks
            grunt.initConfig({
                pkg: grunt.file.readJSON('package.json'),
                clean: {
                    options: {
                        force: true
                    },
                    www: [
                        app.wwwPath + '*',
                        getFullPath('scss') + '_' + app.name + '-icons.scss'
                    ],
                    mapFiles: [
                    	getFullPath('css') + '/*.map',
                        getFullPath('css-print') + '/*.map',
                    ],
                    webfonts: [
                    	getWebFontsPath()
                    ],
                    webicons: [
                    	getWebIconsPath()
                    ]
                },
                tasty_swig: {
                	options: {
                		context: {
                			app: getAppConfig()
                		}
                	},
                	build: {
						src: [ getFullPath() + '*.swig' ],
						dest: app.wwwPath
					}
                },
				sass: {
					build: {
						files: app.scssConfigFiles
					},
					deploy: {
						files: app.scssConfigFiles
					},
				},
				fontgen: {
					build: {
						options: {
							path_prefix: '../fonts/'
						},
						files: app.fontConfigFiles
					}
				},
				webfont: {
					icons: {
						src: getIconsPath() + '*.svg',
						dest: getWebIconsPath(),
						options: {
                            relativeFontPath: '../fonts/',
							font: app.name + '-icons',
                            stylesheet: 'scss',
                            templateOptions: {
                                baseClass: app.name + '-icon',
                                classPrefix: app.name + '-icon-',
                                mixinPrefix: app.name + '-icon-'
                            }
						}
					}
				},
                concat: {
                	webfonts: {
                		files: app.webFontConfigFiles
                	},
                    css: {
                        filter: 'isFile',
                        src: getFullPath( app.cssPath ),
                        dest: app.wwwPath + app.cssMin
                    },
                    cssPrint: {
                        filter: 'isFile',
                        src: getFullPath( app.cssPrintPath ),
                        dest: app.wwwPath + app.cssPrintMin
                    },
                    js: {
                    	files: app.jsConfigFiles
                    }
                },
                autoprefixer: {
                    options: {
                        map: true,
                        browsers: ['last 3 versions', 'bb 10', 'android 3']
                    },
                    build: {
                        src: app.wwwPath + 'css/*.css'
                    },
                },
                cssmin: {
                    build: {
                        files: app.cssConfigFiles
                    }
                },
                closurecompiler: {
                    build: {
                    	files: app.jsConfigFiles,
                    	options: {
			                // Any options supported by Closure Compiler, for example:
			                "compilation_level": "SIMPLE_OPTIMIZATIONS",

			                // Plus a simultaneous processes limit
			                "max_processes": 5,
			            }
                    }
                },
                copy: {
                    build: {
                        files: [
	                        // The project CSS and JS files
	                        {
	                            expand: true,
	                            cwd: getFullPath(),
	                            src: [
	                                app.cssPath,
	                                app.cssPrintPath,
	                                app.cssMapPath,
	                                app.cssPrintMapPath,
	                                app.jsPath
	                            ],
	                            dest: app.wwwPath
	                        },
                            {
                                expand: true,
                                cwd: getWebIconsPath(),
                                src: [
                                    '*.scss'
                                ],
                                dest: getFullPath('scss')
                            }
                        ]
                    },
                    deploy: {
                        files: [
                        	// External Packages Fonts
                        	{
                        		expand: true,
                        		flatten: true,
                        		cwd: 'bower_components/',
                        		src: ['**/*.{ttf,woff,eot,svg,otf}'],
                        		dest: app.wwwPath + '/fonts/'
                        	},
                        	// The project Webfonts
                        	{
                        		expand: true,
                        		flatten: true,
                        		cwd: getWebFontsPath(),
                        		src: ['**/*.{ttf,woff,eot,svg,otf}'],
                        		dest: app.wwwPath + '/fonts/'
                        	},
                        	// The project Webicons
                        	{
                        		expand: true,
                        		flatten: true,
                        		cwd: getWebIconsPath(),
                        		src: ['**/*.{ttf,woff,eot,svg,otf}'],
                        		dest: app.wwwPath + '/fonts/'
                        	},
                        	// Webicons sass generated file
                        	{
                                expand: true,
                                cwd: getWebIconsPath(),
                                src: [
                                    '*.scss'
                                ],
                                dest: getFullPath('scss')
                            },
                        	// The project resource files
	                        {
	                            expand: true,
	                            cwd: getResourcePath(),
	                            src: ['**'],
	                            dest: app.wwwPath
	                        }
                        ]
                    },
                    make: {
                        files: [{
                            expand: true,
                            cwd: '_apptpl/',
                            src: ['**'],
                            dest: app.path
                        }]
                    }
                },
                watch: {
                    html: {
                        options: {
                            livereload: app.liveReloadPort
                        },
                        files: [
                            getFullPath() + '**/*.swig',
                            app.path + '/data.json'
                        ],
                        tasks: [
                        	'rebuild:' + app.name + ':html'
                        ]
                    },
                    css: {
                        options: {
                            livereload: app.liveReloadPort
                        },
                        files: [
                            getFullPath() + '**/*.scss',
                        ],
                        tasks: [
                            'rebuild:' + app.name + ':css'
                        ]
                    },
                    js: {
                        options: {
                            livereload: app.liveReloadPort
                        },
                        files: [
                            getFullPath() + '**/*.js'
                        ],
                        tasks: [
                            'rebuild:' + app.name + ':js'
                        ]
                    }
                },
                rsync: {
                    options: {
                        recursive: true
                    },
                    deploy: {
                        options: {
                            src: app.wwwPath,
                            dest: app.deployPath,
                            host: app.deployHost
                        }
                    }
                }
            });
        };

    // Load Tasks
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-yui-compressor');
    grunt.loadNpmTasks('grunt-closurecompiler');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-tasty-swig');
    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-rsync');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-fontgen');
    grunt.loadNpmTasks('grunt-webfont');

    grunt.registerTask('default', 'Gruntfile for Mockups', function() {
        grunt.warn('No project name specified.\n\nAvailable commands:\n"build:project_name"\n"deploy:project_name"\n"make:project_name"\n');
    });

    grunt.registerTask('build', 'Build a mockup and watch for file modifications', function ( name ) {
        if (appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'rebuild:' + name,
                'watch'
            ]);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('rebuild', 'Build a mockup without watching for file modifications', function ( name, watchTask ) {
        if (appExists(name)) {
            var tasks = [];
            if ( watchTask === undefined ) watchTask = 'all';

            if ( watchTask == 'all' ) {
                tasks = tasks.concat([
                    'clean',
                    'fontgen',
                    'webfont',
                    'concat:webfonts',
                    'copy:build',
                    'sass:build',
                    'autoprefixer',
                    'concat:js',
                    'tasty_swig',
                    'copy:deploy',
                    'clean:mapFiles',
                    'clean:webfonts',
                    'clean:webicons'
                ]);
            } else if ( watchTask == 'html' ) {
                tasks = tasks.concat([
                    'tasty_swig',
                    'copy:deploy',
                    'copy:build'
                ]);
            } else if ( watchTask == 'css' ) {
                tasks = tasks.concat([
                    'sass:build',
                    'autoprefixer',
                    'copy:deploy',
                    'copy:build'
                ]);
            } else if ( watchTask == 'js' ) {
                tasks = tasks.concat([
                    'concat:js',
                    'copy:deploy',
                    'copy:build'
                ]);
            }

            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run(tasks);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('build_deploy', 'Build a mockup ready for deployment sync', function ( name ) {
        if (appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'clean',
                'fontgen',
                'webfont',
                'concat:webfonts',
                'copy:deploy',
                'sass:deploy',
                'concat:css',
                'concat:cssPrint',
                'autoprefixer',
                'cssmin',
                'closurecompiler',
                'tasty_swig',
                'clean:mapFiles',
                'clean:webfonts',
                'clean:webicons'
            ]);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('deploy', 'Deploy a mockup to the Mockups Server', function ( name ) {
    	if (appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'build_deploy:' + name,
                'rsync:deploy'
            ]);
        } else
            grunt.warn('[' + name + '] does not exist. Have you typed it correctly?\n');
    });

    grunt.registerTask('make', 'Create a new mockup folder based on a template', function ( name ) {
        if (!appExists(name)) {
            setAppConfig(this.name, {
                name: name
            });
            grunt.task.run([
                'copy:make'
            ]);
        } else
            grunt.warn('[' + name + '] already exists. Please use another name.\n');
    });
};
<|endoftext|>


<commit_before>/*global module:false*/

module.exports = function (grunt) {
  'use strict';
  var path = require('path');
  var mountFolder = function (connect, dir) {
    return connect.static(path.resolve(dir));
  };

  var configuration = {
    pkg: grunt.file.readJSON('package.json'),
    dir: {
      src: {
        root: 'src',
        demos: '<%= config.dir.src.root %>/demos',
        widgets: '<%= config.dir.src.root %>/widgets'
      },
      dist: {
        root: 'dist',
        assets: '<%= config.dir.dist.root %>/assets',
        demos: '<%= config.dir.dist.root %>/demos',
        flot: '<%= config.dir.dist.assets %>/flot',
        font: '<%= config.dir.dist.assets %>/font-awesome/font',
        richwidgets: '<%= config.dir.dist.assets %>/richwidgets'
      },
      test: {
        root: 'test'
      },
      lib: {
        root: 'lib',
        bootstrap: '<%= config.dir.lib.root %>/bootstrap',
        fontawesome: '<%= config.dir.lib.root %>/font-awesome',
        jquery: '<%= config.dir.lib.root %>/jquery',
        jqueryui: '<%= config.dir.lib.root %>/jquery-ui',
        flot: {
          lib: '<%= config.dir.lib.root %>/flot',
          axisLabels: '<%= config.dir.lib.root %>/flotAxisLabels',
          orderBars: '<%= config.dir.lib.root %>/flotOrderBars',
          tooltip :  '<%= config.dir.lib.root %>/flotTooltip'
        }
      }
    },
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n'
  };

  grunt.registerTask('bower', [
    'shell:bowerInstall'
  ]);

  grunt.registerTask('build', [
    'jshint',
    'copy:font',
    'copy:jquery',
    'copy:jqueryui',
    'copy:flot',
    'copy:js',
    'less:bootstrap',
    'less:fontawesome',
    'less:widgets',
    'less:dist',
    'concat:flot',
    'uglify:dist',
    'copy:demoAssets',
    'copy:demoResources',
    'yuidoc'
  ]);

  grunt.registerTask('default', [
    'dist'
  ]);

  grunt.registerTask('dist', [
    'clean:dist',
    'build',
    'uglify:demo',
    'cssmin:demo',
    'assemble:production',
    'test'
  ]);

  grunt.registerTask('test', [
    'karma:test'
  ]);

  grunt.registerTask('travis', [
    'dist'
  ]);

  grunt.registerTask('dev', [
    'clean:demo',
    'build',
    'assemble:dev',
//    'karma:dev',
    'connect:dev',
    'watch'
  ]);

  grunt.registerTask('site', [
    'dist',
    'clean:pages',
    'gh-pages'
  ]);

  grunt.initConfig({
    config: configuration,
    demo: grunt.file.readYAML('src/demos/data/site.yml'),

    clean: {
      dist: [ '<%= config.dir.dist.root %>' ],
      demo: ['<%= demo.destination %>/**/*.{html,md}'],
      pages: ['.grunt/grunt-gh-pages/gh-pages'],
      bower: ['lib']
    },

    less: {
      bootstrap: {
        options: {
          paths: ['<%= config.dir.lib.bootstrap %>/less']
        },
        src: 'lib/rcue/less/rcue.less',
        dest: '<%= config.dir.dist.assets %>/bootstrap/bootstrap.css'
      },
      fontawesome: {
        options: {
          paths: ['<%= config.dir.lib.fontawesome %>/less']
        },
        src: '<%= config.dir.src.widgets %>/font-awesome-richwidgets.less',
        dest: '<%= config.dir.dist.assets %>/font-awesome/font-awesome.css'
      },
      widgets: {
        options: {
          paths: ['<%= config.dir.src.widgets %>', '<%= config.dir.lib.root %>']
        },
        files: grunt.file.expandMapping('*/**/*.less', '<%= config.dir.dist.richwidgets %>/', { // */**/*.less: exclude files in the widgets folder itself
          cwd: 'src/widgets',
          rename: function (destBase, destPath) {
            return destBase + destPath.replace(/\.less$/, '.css');
          }
        })
      },
      dist: {
        options: {
          paths: ['<%= config.dir.src.widgets %>', '<%= config.dir.lib.root %>'],
          yuicompress: true
        },
        src: '<%= config.dir.src.widgets %>/main.less',
        dest: '<%= config.dir.dist.richwidgets %>/richwidgets.min.css'
      }
    },

    cssmin: {
      demo: {
        files: {
          '<%= config.dir.dist.demos %>/assets-demo/richwidgets-demo.min.css': ['<%= config.dir.dist.richwidgets %>/richwidgets.min.css', '<%= config.dir.dist.assets %>/font-awesome/font-awesome.css']
        }
      }
    },

    uglify: {
      options: {
        banner: '// JBoss RedHat (c)\n'
      },
      dist: {
        options: {
          compress: true
        },
        files: [
          {
            '<%= config.dir.dist.assets %>/richwidgets/richwidgets.min.js': ['<%= config.dir.dist.flot %>/richwidgets.flot.js', '<%= config.dir.src.widgets %>/**/*.js']
          }
        ]
      },
      demo: {
        options: {
          compress: true,
          nonull: true
        },
        files: [
          {
            '<%= config.dir.dist.demos %>/assets-demo/richwidgets-demo.min.js': [
              '<%= config.dir.dist.assets %>/jquery/jquery.min.js',
              '<%= config.dir.dist.assets %>/jquery-ui/minified/jquery-ui.min.js',
              '<%= config.dir.dist.flot %>/richwidgets.flot.js',
              '<%= config.dir.dist.richwidgets %>/richwidgets.min.js'
            ]
          }
        ]
      }
    },

    concat: {
      flot: {
        options: {
          separator: ';',
          nonull: true
        },
        src: [
          '<%= config.dir.dist.flot %>/jquery.flot.js',
          '<%= config.dir.dist.flot %>/jquery.flot.selection.js',
          '<%= config.dir.dist.flot %>/jquery.flot.pie.js',
          '<%= config.dir.dist.flot %>/jquery.flot.categories.js',
          '<%= config.dir.dist.flot %>/jquery.flot.symbol.js',
          '<%= config.dir.dist.flot %>/jquery.flot.tooltip.js',
          '<%= config.dir.dist.flot %>/jquery.flot.orderBars.js',
          '<%= config.dir.dist.flot %>/jquery.flot.resize.js'
        ],
        dest: '<%= config.dir.dist.flot %>/richwidgets.flot.js'
      }
    },

    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: 'nofunc',
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: 'vars',
        boss: true,
        eqnull: true,
        browser: true,
        trailing: true,
        quotmark: 'single',
        camelcase:true
      },
      gruntfile: {
        options: {
          indent: 2,
          globals: {
            jQuery: true,
            require: true
          }
        },
        src: 'Gruntfile.js'
      },
      widgets: {
        options: {
          globals: {
            jQuery: true
          }
        },
        src: ['src/widgets/**/*.js']
      },
      demos: {
        options: {
          globals: {
            '$': true,
            module: true,
            require: true,
            source: true  // global used in autocomplete demos
          }
        },
        src: ['src/demos/**/*.js']
      },
      tests: {
        options: {
          camelcase:false,
          globals: {
            jQuery: true,
            '$': true,
            it: true,
            expect: true,
            runs: true,
            waitsFor: true,
            beforeEach: true,
            afterEach: true,
            define: true,
            describe: true,
            jasmine: true,
            requirejs: true
          }
        },
        src: ['test/**/*.js']
      }
    },

    copy: {
      font: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.fontawesome %>/fonts',
            src: ['**'],
            dest: '<%= config.dir.dist.font %>'
          }
        ]
      },
      jquery: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.jquery %>',
            src: ['*.js', '*.map'],
            dest: '<%= config.dir.dist.assets %>/jquery'
          }
        ]
      },
      jqueryui: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.jqueryui %>/ui',
            src: ['**'],
            dest: '<%= config.dir.dist.assets %>/jquery-ui'
          }
        ]
      },
      flot: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.lib %>',
            src: ['**.js','!**/examples/**','!jquery.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          },
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.axisLabels %>',
            src: ['**.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          },
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.orderBars %>/js',
            src: ['**.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          },
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.tooltip %>/js',
            src: ['**.js','!jquery.flot.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          }
        ]
      },
      js: {
        files: grunt.file.expandMapping('**/*.js', '<%= config.dir.dist.richwidgets %>/', {
          cwd: 'src/widgets',
          rename: function (destBase, destPath) {
            return destBase + destPath;
          }
        })
      },
      demoAssets: {
        options: {
          banner: '<%= banner %>'
        },
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.root %>',
            src: [
              'modernizr/modernizr.js',
              'highlightjs/highlight.pack.js',
              'highlightjs/styles/github.css',
              'bootstrap/js/dropdown.js',
              'bootstrap/js/collapse.js'
            ],
            dest: '<%= config.dir.dist.demos %>/assets-demo/'
          },
          {
            expand: true,
            cwd: '<%= config.dir.dist.font %>',
            src: '*',
            dest: '<%= config.dir.dist.demos %>/assets-demo/font/'
          },
          {
            expand: true,
            cwd: '<%= config.dir.src.demos %>/pages',
            src: ['**/*.{css,js}'],
            dest: '<%= config.dir.dist.demos %>/assets-demo/'
          }
        ]
      },
      demoResources: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.src.demos %>',
            src: ['CNAME', '**/*.png'],
            dest: '<%= config.dir.dist.demos %>/'
          }
        ]
      }
    },

    shell: {
      options: {
        stdout: true
      },
      bowerInstall: {
        command: 'bower install'
      }
    },

    parallel: {
      options: {
        grunt: true
      }
    },

    karma: {
      options: {
        configFile: 'karma.conf.js'
      },
      test: {
        singleRun: true,
        autoWatch: false
      },
      dev: {
        singleRun: false,
        autoWatch: false,
        background: true,  // run karma in a child process so it doesn't block subsequent grunt tasks
        reporters: 'dots'
      }
    },

    watch: {
      options: {
        livereload: false,
        forever: true
      },
      less: {
        files: ['<%= config.dir.src.widgets %>/**/*.less'],
        tasks: ['less:widgets']
      },
      js: {
        files: ['<%= config.dir.src.widgets %>/**/*.js'],
        tasks: ['copy:js', 'yuidoc']
      },
      // Activate once the following issue is resolved:
      // https://github.com/gruntjs/grunt-contrib-watch/issues/186
      // karma: {
      //   files: ['<%= config.dir.src.widgets %>/**/*.js', '<%= config.dir.test.root %>/**/*.js'],
      //   tasks: ['karma:dev:run']
      // },
      demo: {
        files: [
          '<%= config.dir.src.demos %>/**',
          'README.md',
          'CONTRIBUTING.md',
          'TESTS.md'
        ],
        tasks: ['copy:demoAssets', 'assemble:dev']
      },
      dist: {
        options: {
          livereload: true
        },
        files: [
          '<%= config.dir.dist.assets %>/**/*.js',
          '<%= config.dir.dist.assets %>/**/*.css',
          '<%= config.dir.dist.demos %>/**/*.html'
        ],
        tasks: []
      }
    },

    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        //hostname: 'localhost'
        hostname: '0.0.0.0'
      },
      demo: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, 'dist/demos')
            ];
          }
        }
      },
      dev: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, 'dist/demos'),
              mountFolder(connect, 'dist')
            ];
          }
        }
      }
    },

    yuidoc: {
      compile: {
        name: '<%= config.pkg.name %>',
        description: '<%= config.pkg.description %>',
        logo: '../logo.png',
        version: '<%= config.pkg.version %>',
        url: '<%= config.pkg.homepage %>',
        options: {
          paths: 'src/widgets',
          themedir: 'lib/yuidoc-bootstrap-theme',
          helpers : ['lib/yuidoc-bootstrap-theme/helpers/helpers.js'],
          outdir: 'dist/demos/api'
        }
      }
    },

    assemble: {
      options: {
        prettify: {indent: 2},
        data: 'src/demos/**/*.{json,yml}',
        assets: './dist/demos/assets',
        helpers: ['src/demos/helpers/helper-*.js', 'node_modules/yfm/lib/*.js'],
        layoutdir: 'src/demos/templates/layouts',
        layout: 'default.hbs',
        partials: ['src/demos/templates/includes/**/*.hbs'],
        postprocess: function(content) {
          // replace links to github markdown files with relative links to html versions of the files
          content = content.replace(/https:\/\/github\.com\/richwidgets\/richwidgets\/blob\/master\/([a-zA-Z]*)\.md/g, function(match, name) {
            return name === 'README' ? 'about.html' : name.toLowerCase() + '.html';
          });
          return content;
        }
      },
      production: {
        options: {production: true},
        files: [
          { expand: true, cwd: 'src/demos/pages', src: ['**/*.hbs'], dest: '<%= demo.destination %>/' }
        ]
      },
      dev: {
        options: {production: false},
        files: [
          { expand: true, cwd: 'src/demos/pages', src: ['**/*.hbs'], dest: '<%= demo.destination %>/' }
        ]
      }
    },

    'gh-pages': {
      options: {
        base: 'dist/demos',
        branch: 'master',
        repo: 'git@github.com:richwidgets/richwidgets.github.io.git'
      },
      src: ['**']
    }
  });

  // load all the grunt-* dependencies found in the package.json file
  require('matchdep').filterDev('grunt-*').forEach(function (plugin) {
    grunt.loadNpmTasks(plugin);
  });

  grunt.loadNpmTasks('assemble');
  grunt.loadNpmTasks('assemble-less');  // not related to assemble
};
<commit_msg>copy RCUE specific fonts to assets/demos #116<commit_after>/*global module:false*/

module.exports = function (grunt) {
  'use strict';
  var path = require('path');
  var mountFolder = function (connect, dir) {
    return connect.static(path.resolve(dir));
  };

  var configuration = {
    pkg: grunt.file.readJSON('package.json'),
    dir: {
      src: {
        root: 'src',
        demos: '<%= config.dir.src.root %>/demos',
        widgets: '<%= config.dir.src.root %>/widgets'
      },
      dist: {
        root: 'dist',
        assets: '<%= config.dir.dist.root %>/assets',
        demos: '<%= config.dir.dist.root %>/demos',
        flot: '<%= config.dir.dist.assets %>/flot',
        font: '<%= config.dir.dist.assets %>/font-awesome/font',
        richwidgets: '<%= config.dir.dist.assets %>/richwidgets'
      },
      test: {
        root: 'test'
      },
      lib: {
        root: 'lib',
        bootstrap: '<%= config.dir.lib.root %>/bootstrap',
        fontawesome: '<%= config.dir.lib.root %>/font-awesome',
        jquery: '<%= config.dir.lib.root %>/jquery',
        jqueryui: '<%= config.dir.lib.root %>/jquery-ui',
        flot: {
          lib: '<%= config.dir.lib.root %>/flot',
          axisLabels: '<%= config.dir.lib.root %>/flotAxisLabels',
          orderBars: '<%= config.dir.lib.root %>/flotOrderBars',
          tooltip :  '<%= config.dir.lib.root %>/flotTooltip'
        }
      }
    },
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n'
  };

  grunt.registerTask('bower', [
    'shell:bowerInstall'
  ]);

  grunt.registerTask('build', [
    'jshint',
    'copy:font',
    'copy:jquery',
    'copy:jqueryui',
    'copy:flot',
    'copy:js',
    'less:bootstrap',
    'less:fontawesome',
    'less:widgets',
    'less:dist',
    'concat:flot',
    'uglify:dist',
    'copy:demoAssets',
    'copy:demoResources',
    'yuidoc'
  ]);

  grunt.registerTask('default', [
    'dist'
  ]);

  grunt.registerTask('dist', [
    'clean:dist',
    'build',
    'uglify:demo',
    'cssmin:demo',
    'assemble:production',
    'test'
  ]);

  grunt.registerTask('test', [
    'karma:test'
  ]);

  grunt.registerTask('travis', [
    'dist'
  ]);

  grunt.registerTask('dev', [
    'clean:demo',
    'build',
    'assemble:dev',
//    'karma:dev',
    'connect:dev',
    'watch'
  ]);

  grunt.registerTask('site', [
    'dist',
    'clean:pages',
    'gh-pages'
  ]);

  grunt.initConfig({
    config: configuration,
    demo: grunt.file.readYAML('src/demos/data/site.yml'),

    clean: {
      dist: [ '<%= config.dir.dist.root %>' ],
      demo: ['<%= demo.destination %>/**/*.{html,md}'],
      pages: ['.grunt/grunt-gh-pages/gh-pages'],
      bower: ['lib']
    },

    less: {
      bootstrap: {
        options: {
          paths: ['<%= config.dir.lib.bootstrap %>/less']
        },
        src: 'lib/rcue/less/rcue.less',
        dest: '<%= config.dir.dist.assets %>/bootstrap/bootstrap.css'
      },
      fontawesome: {
        options: {
          paths: ['<%= config.dir.lib.fontawesome %>/less']
        },
        src: '<%= config.dir.src.widgets %>/font-awesome-richwidgets.less',
        dest: '<%= config.dir.dist.assets %>/font-awesome/font-awesome.css'
      },
      widgets: {
        options: {
          paths: ['<%= config.dir.src.widgets %>', '<%= config.dir.lib.root %>']
        },
        files: grunt.file.expandMapping('*/**/*.less', '<%= config.dir.dist.richwidgets %>/', { // */**/*.less: exclude files in the widgets folder itself
          cwd: 'src/widgets',
          rename: function (destBase, destPath) {
            return destBase + destPath.replace(/\.less$/, '.css');
          }
        })
      },
      dist: {
        options: {
          paths: ['<%= config.dir.src.widgets %>', '<%= config.dir.lib.root %>'],
          yuicompress: true
        },
        src: '<%= config.dir.src.widgets %>/main.less',
        dest: '<%= config.dir.dist.richwidgets %>/richwidgets.min.css'
      }
    },

    cssmin: {
      demo: {
        files: {
          '<%= config.dir.dist.demos %>/assets-demo/richwidgets-demo.min.css': ['<%= config.dir.dist.richwidgets %>/richwidgets.min.css', '<%= config.dir.dist.assets %>/font-awesome/font-awesome.css']
        }
      }
    },

    uglify: {
      options: {
        banner: '// JBoss RedHat (c)\n'
      },
      dist: {
        options: {
          compress: true
        },
        files: [
          {
            '<%= config.dir.dist.assets %>/richwidgets/richwidgets.min.js': ['<%= config.dir.dist.flot %>/richwidgets.flot.js', '<%= config.dir.src.widgets %>/**/*.js']
          }
        ]
      },
      demo: {
        options: {
          compress: true,
          nonull: true
        },
        files: [
          {
            '<%= config.dir.dist.demos %>/assets-demo/richwidgets-demo.min.js': [
              '<%= config.dir.dist.assets %>/jquery/jquery.min.js',
              '<%= config.dir.dist.assets %>/jquery-ui/minified/jquery-ui.min.js',
              '<%= config.dir.dist.flot %>/richwidgets.flot.js',
              '<%= config.dir.dist.richwidgets %>/richwidgets.min.js'
            ]
          }
        ]
      }
    },

    concat: {
      flot: {
        options: {
          separator: ';',
          nonull: true
        },
        src: [
          '<%= config.dir.dist.flot %>/jquery.flot.js',
          '<%= config.dir.dist.flot %>/jquery.flot.selection.js',
          '<%= config.dir.dist.flot %>/jquery.flot.pie.js',
          '<%= config.dir.dist.flot %>/jquery.flot.categories.js',
          '<%= config.dir.dist.flot %>/jquery.flot.symbol.js',
          '<%= config.dir.dist.flot %>/jquery.flot.tooltip.js',
          '<%= config.dir.dist.flot %>/jquery.flot.orderBars.js',
          '<%= config.dir.dist.flot %>/jquery.flot.resize.js'
        ],
        dest: '<%= config.dir.dist.flot %>/richwidgets.flot.js'
      }
    },

    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: 'nofunc',
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: 'vars',
        boss: true,
        eqnull: true,
        browser: true,
        trailing: true,
        quotmark: 'single',
        camelcase:true
      },
      gruntfile: {
        options: {
          indent: 2,
          globals: {
            jQuery: true,
            require: true
          }
        },
        src: 'Gruntfile.js'
      },
      widgets: {
        options: {
          globals: {
            jQuery: true
          }
        },
        src: ['src/widgets/**/*.js']
      },
      demos: {
        options: {
          globals: {
            '$': true,
            module: true,
            require: true,
            source: true  // global used in autocomplete demos
          }
        },
        src: ['src/demos/**/*.js']
      },
      tests: {
        options: {
          camelcase:false,
          globals: {
            jQuery: true,
            '$': true,
            it: true,
            expect: true,
            runs: true,
            waitsFor: true,
            beforeEach: true,
            afterEach: true,
            define: true,
            describe: true,
            jasmine: true,
            requirejs: true
          }
        },
        src: ['test/**/*.js']
      }
    },

    copy: {
      font: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.fontawesome %>/fonts',
            src: ['**'],
            dest: '<%= config.dir.dist.font %>'
          },
          {
            expand: true,
            cwd: 'lib/rcue/dist/fonts',
            src: '*',
            dest: '<%= config.dir.dist.assets %>/fonts/'
          }
        ]
      },
      jquery: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.jquery %>',
            src: ['*.js', '*.map'],
            dest: '<%= config.dir.dist.assets %>/jquery'
          }
        ]
      },
      jqueryui: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.jqueryui %>/ui',
            src: ['**'],
            dest: '<%= config.dir.dist.assets %>/jquery-ui'
          }
        ]
      },
      flot: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.lib %>',
            src: ['**.js','!**/examples/**','!jquery.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          },
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.axisLabels %>',
            src: ['**.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          },
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.orderBars %>/js',
            src: ['**.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          },
          {
            expand: true,
            cwd: '<%= config.dir.lib.flot.tooltip %>/js',
            src: ['**.js','!jquery.flot.js'],
            dest: '<%= config.dir.dist.assets %>/flot'
          }
        ]
      },
      js: {
        files: grunt.file.expandMapping('**/*.js', '<%= config.dir.dist.richwidgets %>/', {
          cwd: 'src/widgets',
          rename: function (destBase, destPath) {
            return destBase + destPath;
          }
        })
      },
      demoAssets: {
        options: {
          banner: '<%= banner %>'
        },
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.lib.root %>',
            src: [
              'modernizr/modernizr.js',
              'highlightjs/highlight.pack.js',
              'highlightjs/styles/github.css',
              'bootstrap/js/dropdown.js',
              'bootstrap/js/collapse.js'
            ],
            dest: '<%= config.dir.dist.demos %>/assets-demo/'
          },
          {
            expand: true,
            cwd: '<%= config.dir.dist.font %>',
            src: '*',
            dest: '<%= config.dir.dist.demos %>/assets-demo/font/'
          },
          {
            expand: true,
            cwd: 'lib/rcue/dist/fonts',
            src: '*',
            dest: '<%= config.dir.dist.demos %>/fonts/'
          },
          {
            expand: true,
            cwd: '<%= config.dir.src.demos %>/pages',
            src: ['**/*.{css,js}'],
            dest: '<%= config.dir.dist.demos %>/assets-demo/'
          }
        ]
      },
      demoResources: {
        files: [
          {
            expand: true,
            cwd: '<%= config.dir.src.demos %>',
            src: ['CNAME', '**/*.png'],
            dest: '<%= config.dir.dist.demos %>/'
          }
        ]
      }
    },

    shell: {
      options: {
        stdout: true
      },
      bowerInstall: {
        command: 'bower install'
      }
    },

    parallel: {
      options: {
        grunt: true
      }
    },

    karma: {
      options: {
        configFile: 'karma.conf.js'
      },
      test: {
        singleRun: true,
        autoWatch: false
      },
      dev: {
        singleRun: false,
        autoWatch: false,
        background: true,  // run karma in a child process so it doesn't block subsequent grunt tasks
        reporters: 'dots'
      }
    },

    watch: {
      options: {
        livereload: false,
        forever: true
      },
      less: {
        files: ['<%= config.dir.src.widgets %>/**/*.less'],
        tasks: ['less:widgets']
      },
      js: {
        files: ['<%= config.dir.src.widgets %>/**/*.js'],
        tasks: ['copy:js', 'yuidoc']
      },
      // Activate once the following issue is resolved:
      // https://github.com/gruntjs/grunt-contrib-watch/issues/186
      // karma: {
      //   files: ['<%= config.dir.src.widgets %>/**/*.js', '<%= config.dir.test.root %>/**/*.js'],
      //   tasks: ['karma:dev:run']
      // },
      demo: {
        files: [
          '<%= config.dir.src.demos %>/**',
          'README.md',
          'CONTRIBUTING.md',
          'TESTS.md'
        ],
        tasks: ['copy:demoAssets', 'assemble:dev']
      },
      dist: {
        options: {
          livereload: true
        },
        files: [
          '<%= config.dir.dist.assets %>/**/*.js',
          '<%= config.dir.dist.assets %>/**/*.css',
          '<%= config.dir.dist.demos %>/**/*.html'
        ],
        tasks: []
      }
    },

    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        //hostname: 'localhost'
        hostname: '0.0.0.0'
      },
      demo: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, 'dist/demos')
            ];
          }
        }
      },
      dev: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, 'dist/demos'),
              mountFolder(connect, 'dist')
            ];
          }
        }
      }
    },

    yuidoc: {
      compile: {
        name: '<%= config.pkg.name %>',
        description: '<%= config.pkg.description %>',
        logo: '../logo.png',
        version: '<%= config.pkg.version %>',
        url: '<%= config.pkg.homepage %>',
        options: {
          paths: 'src/widgets',
          themedir: 'lib/yuidoc-bootstrap-theme',
          helpers : ['lib/yuidoc-bootstrap-theme/helpers/helpers.js'],
          outdir: 'dist/demos/api'
        }
      }
    },

    assemble: {
      options: {
        prettify: {indent: 2},
        data: 'src/demos/**/*.{json,yml}',
        assets: './dist/demos/assets',
        helpers: ['src/demos/helpers/helper-*.js', 'node_modules/yfm/lib/*.js'],
        layoutdir: 'src/demos/templates/layouts',
        layout: 'default.hbs',
        partials: ['src/demos/templates/includes/**/*.hbs'],
        postprocess: function(content) {
          // replace links to github markdown files with relative links to html versions of the files
          content = content.replace(/https:\/\/github\.com\/richwidgets\/richwidgets\/blob\/master\/([a-zA-Z]*)\.md/g, function(match, name) {
            return name === 'README' ? 'about.html' : name.toLowerCase() + '.html';
          });
          return content;
        }
      },
      production: {
        options: {production: true},
        files: [
          { expand: true, cwd: 'src/demos/pages', src: ['**/*.hbs'], dest: '<%= demo.destination %>/' }
        ]
      },
      dev: {
        options: {production: false},
        files: [
          { expand: true, cwd: 'src/demos/pages', src: ['**/*.hbs'], dest: '<%= demo.destination %>/' }
        ]
      }
    },

    'gh-pages': {
      options: {
        base: 'dist/demos',
        branch: 'master',
        repo: 'git@github.com:richwidgets/richwidgets.github.io.git'
      },
      src: ['**']
    }
  });

  // load all the grunt-* dependencies found in the package.json file
  require('matchdep').filterDev('grunt-*').forEach(function (plugin) {
    grunt.loadNpmTasks(plugin);
  });

  grunt.loadNpmTasks('assemble');
  grunt.loadNpmTasks('assemble-less');  // not related to assemble
};
<|endoftext|>


<commit_before>/*global module*/
/*jshint node: true*/

var WRAPPER_HEADER = 'var Crocodoc = (function ($) {\n\n',
    WRAPPER_FOOTER = '\n\nreturn Crocodoc;\n})(jQuery);';

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-qunit');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-connect-rewrite');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-image-embed');

    var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        connect: {
            options: {
                hostname: '*',
                port: 9000,
                keepalive: true
            },
            rules: [
                {from: '^/examples/remember-page/(.*)$', to: '/examples/remember-page/index.html'}
            ],
            development: {
                options: {
                    middleware: function (connect, options) {
                        var middlewares = [];

                        // RewriteRules support
                        middlewares.push(rewriteRulesSnippet);

                        if (!Array.isArray(options.base)) {
                            options.base = [options.base];
                        }

                        var directory = options.directory || options.base[options.base.length - 1];
                        options.base.forEach(function (base) {
                            // Serve static files.
                            middlewares.push(connect.static(base));
                        });

                        // Make directory browse-able.
                        middlewares.push(connect.directory(directory));

                        return middlewares;
                    }
                }
            }
        },
        cssmin: {
            minify: {
                files: [{
                    'dist/crocodoc.viewer.min.css': ['<%= concat.css.dest %>']
                }]
            }
        },
        uglify: {
            options: {
                mangle: true,
                compress: true,
                preserveComments: 'some'
            },
            dist: {
                files: [{
                    'dist/crocodoc.viewer.min.js': ['<%= concat.js.dest %>']
                }]
            }
        },
        concat: {
            options: {
                stripBanners: true,
                banner: '/*! <%= pkg.description %> - v<%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Box */\n\n',
            },
            js: {
                // also use the jQuery wrapper for js files
                options: {
                    banner: '<%= concat.options.banner %>' + WRAPPER_HEADER,
                    footer: WRAPPER_FOOTER
                },
                src: [
                    'src/js/core/crocodoc.js',
                    'src/js/core/scope.js',
                    'src/js/core/event-target.js',
                    'src/js/core/viewer.js',
                    'src/js/utilities/*.js',
                    'src/js/components/*.js',
                ],
                dest: 'dist/crocodoc.viewer.js'
            },
            css: {
                src: [
                    'src/css/viewer.css',
                    'src/css/presentation.css',
                    'src/css/theme.css',
                    'src/css/logo.css'
                ],
                dest: 'dist/crocodoc.viewer.css'
            },
            'css-no-logo': {
                src: [
                    'src/css/viewer.css',
                    'src/css/presentation.css',
                    'src/css/theme.css'
                ],
                dest: 'dist/crocodoc.viewer.css'
            }
        },
        jshint: {
            options: {
                jshintrc: true
            },
            files: ['Gruntfile.js', 'src/js/**/*.js', 'test/js/**/*.js']
        },
        qunit: {
            files: ['test/index.html']
        },
        jsdoc : {
            dist : {
                src: ['src/js/**/*.js', 'test/js/**/*.js'],
                options: {
                    destination: 'doc',
                    configure: 'jsdoc-conf.json'
                }
            }
        },
        imageEmbed: {
            dist: {
                src: ['dist/crocodoc.viewer.css'],
                dest: 'dist/crocodoc.viewer.css',
                options: {
                    deleteAfterEncoding: false,
                    baseDir: './'
                }
            }
        }
    });

    var useLogo = !grunt.option('no-logo');
    var defaultTasks = ['test', 'concat:js'];
    if (useLogo) {
        defaultTasks.push('concat:css', 'imageEmbed');
    } else {
        defaultTasks.push('concat:css-no-logo');
    }

    grunt.registerTask('test', ['jshint', 'qunit']);
    grunt.registerTask('doc', ['test', 'jsdoc']);
    grunt.registerTask('default', defaultTasks);
    grunt.registerTask('build', ['default', 'cssmin', 'uglify']);
    grunt.registerTask('serve', ['default', 'configureRewriteRules', 'connect:development']);
};
<commit_msg>Grunt serve opens browser<commit_after>/*global module*/
/*jshint node: true*/

var WRAPPER_HEADER = 'var Crocodoc = (function ($) {\n\n',
    WRAPPER_FOOTER = '\n\nreturn Crocodoc;\n})(jQuery);';

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-qunit');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-connect-rewrite');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-image-embed');

    var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        connect: {
            options: {
                hostname: '*',
                port: 9000,
                keepalive: true,
                open: true
            },
            rules: [
                {from: '^/examples/remember-page/(.*)$', to: '/examples/remember-page/index.html'}
            ],
            development: {
                options: {
                    middleware: function (connect, options) {
                        var middlewares = [];

                        // RewriteRules support
                        middlewares.push(rewriteRulesSnippet);

                        if (!Array.isArray(options.base)) {
                            options.base = [options.base];
                        }

                        var directory = options.directory || options.base[options.base.length - 1];
                        options.base.forEach(function (base) {
                            // Serve static files.
                            middlewares.push(connect.static(base));
                        });

                        // Make directory browse-able.
                        middlewares.push(connect.directory(directory));

                        return middlewares;
                    }
                }
            }
        },
        cssmin: {
            minify: {
                files: [{
                    'dist/crocodoc.viewer.min.css': ['<%= concat.css.dest %>']
                }]
            }
        },
        uglify: {
            options: {
                mangle: true,
                compress: true,
                preserveComments: 'some'
            },
            dist: {
                files: [{
                    'dist/crocodoc.viewer.min.js': ['<%= concat.js.dest %>']
                }]
            }
        },
        concat: {
            options: {
                stripBanners: true,
                banner: '/*! <%= pkg.description %> - v<%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Box */\n\n',
            },
            js: {
                // also use the jQuery wrapper for js files
                options: {
                    banner: '<%= concat.options.banner %>' + WRAPPER_HEADER,
                    footer: WRAPPER_FOOTER
                },
                src: [
                    'src/js/core/crocodoc.js',
                    'src/js/core/scope.js',
                    'src/js/core/event-target.js',
                    'src/js/core/viewer.js',
                    'src/js/utilities/*.js',
                    'src/js/components/*.js',
                ],
                dest: 'dist/crocodoc.viewer.js'
            },
            css: {
                src: [
                    'src/css/viewer.css',
                    'src/css/presentation.css',
                    'src/css/theme.css',
                    'src/css/logo.css'
                ],
                dest: 'dist/crocodoc.viewer.css'
            },
            'css-no-logo': {
                src: [
                    'src/css/viewer.css',
                    'src/css/presentation.css',
                    'src/css/theme.css'
                ],
                dest: 'dist/crocodoc.viewer.css'
            }
        },
        jshint: {
            options: {
                jshintrc: true
            },
            files: ['Gruntfile.js', 'src/js/**/*.js', 'test/js/**/*.js']
        },
        qunit: {
            files: ['test/index.html']
        },
        jsdoc : {
            dist : {
                src: ['src/js/**/*.js', 'test/js/**/*.js'],
                options: {
                    destination: 'doc',
                    configure: 'jsdoc-conf.json'
                }
            }
        },
        imageEmbed: {
            dist: {
                src: ['dist/crocodoc.viewer.css'],
                dest: 'dist/crocodoc.viewer.css',
                options: {
                    deleteAfterEncoding: false,
                    baseDir: './'
                }
            }
        }
    });

    var useLogo = !grunt.option('no-logo');
    var defaultTasks = ['test', 'concat:js'];
    if (useLogo) {
        defaultTasks.push('concat:css', 'imageEmbed');
    } else {
        defaultTasks.push('concat:css-no-logo');
    }

    grunt.registerTask('test', ['jshint', 'qunit']);
    grunt.registerTask('doc', ['test', 'jsdoc']);
    grunt.registerTask('default', defaultTasks);
    grunt.registerTask('build', ['default', 'cssmin', 'uglify']);
    grunt.registerTask('serve', ['default', 'configureRewriteRules', 'connect:development']);
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    qunit: {
      tests: {
      	src: ['test/**/*.html'],
        options: {
          timeout: 30000,
          "--web-security": "no"
        }
      },
      answers: {
      	src: ['answers/**/*.html'],
        options: {
          timeout: 30000,
          "--web-security": "no"
        }
      },

    },
    jshint: {
      tests: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/test.js']
      },
      answers: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['answers/test.js']
      },
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint', 'qunit']
      },
    },
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks("grunt-qunit-istanbul");
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task.
  grunt.registerTask('default', ['jshint', 'qunit']);

  grunt.registerTask('answers', ['jshint:answers', 'qunit:answers']);

  grunt.registerTask('tests', ['jshint:tests', 'qunit:tests']);

};
<commit_msg>Removed grunt task<commit_after>'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    qunit: {
      tests: {
      	src: ['test/**/*.html'],
        options: {
          timeout: 30000,
          "--web-security": "no"
        }
      },
      answers: {
      	src: ['answers/**/*.html'],
        options: {
          timeout: 30000,
          "--web-security": "no"
        }
      },

    },
    jshint: {
      tests: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/test.js']
      },
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint', 'qunit']
      },
    },
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks("grunt-qunit-istanbul");
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task.
  grunt.registerTask('default', ['jshint', 'qunit']);

  grunt.registerTask('tests', ['jshint:tests', 'qunit:tests']);

};
<|endoftext|>


<commit_before>module.exports = function (grunt) {

  // Package configuration
  grunt.initConfig({

    // Metadata
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * <%= pkg.name %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2014-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',

    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'stylesheets/style.min.css' : '_sass/style.scss'
        }
      },
      dev: {
        options: {
          style: 'expanded'
        },
          files: {
            'stylesheets/style.css': '_sass/style.scss'
        }
      }
    },

    autoprefixer: {
      options: {
        browsers: ['last 2 versions', 'ie 8', 'ie 9'],
        map: true
      },
      dist: {
        src: 'stylesheets/style.min.css'
      },
      dev: {
        src: 'stylesheets/style.css'
      },
    },

    usebanner: {
      options: {
        position: 'bottom',
        banner: '<%= banner %>'
      },
      files: {
        src: ['stylesheets/style.min.css', 'stylesheets/style.css']
      }
    },

    csslint: {
      options: {
        csslintrc: '.csslintrc'
      },
      dist: [
        'stylesheets/style.min.css'
      ],
      dev: [
        'stylesheets/style.css'
      ]
    },

    concat: {
      options: {
        separator: ';',
        banner: '<%= banner %>',
      },
      header_js: {
        src: [
          'javascripts/_typekit.js'
        ],
        dest: 'javascripts/header.js',
      },
      footer_js: {
        src: [
          'bower_components/jquery/dist/jquery.min.js',
          'bower_components/fitvids/jquery.fitvids.js',
          'javascripts/_fitvids.footer.js',
          'javascripts/_iconic.js',
          'javascripts/_google-analytics.js'
          ],
        dest: 'javascripts/footer.js',
      },
    },

    jekyll: {                             // Task
      dist: {                             // Target
        options: {                        // Target options
          dest: '_site',
          config: '_config.yml'
        }
      },
      dev : {
        options : {
          dest: '_site',
          config: '_config-dev.yml'
        }
      }
    },

    validation: {
    options: {
      },
    files: {
        src: ['_site/*.html']
      }
    },

    hologram: {
      generate: {
        options: {
          config: 'hologram_config.yml'
        }
      }
    },

    watch: {
      sass: {
        files: '_sass/**/*.scss',
        tasks: ['sass','autoprefixer',  'usebanner', 'csslint', 'hologram']
      },
      js: {
        files: 'javascripts/**/*.js',
        tasks: ['concat', 'hologram']
      },
      hologram: {
        files: 'stylesheets/*.md',
        tasks: ['hologram']
      },
      jekyll: {
        files: ['index.html', '*.html', '*.md', '_data/*.*', '_layouts/*.html', '_includes/*.html', '_posts/*.*', 'stylesheets/*.css','javascripts/*.js'],
        tasks: ['jekyll:dev', 'validation']
      }
    },

    browserSync: {
      files: {
        src : ['_site/stylesheets/*.css', '_site/*.html', '_site/<%= grunt.template.today("yyyy") %>/**/*.html']
      },
      options: {
        watchTask: true,
        ghostMode: {
          clicks: true,
          scroll: true,
          links: true,
          forms: true
        },
        server: {
          baseDir: '_site'
        }
      }
    },

  });

  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-autoprefixer');
  grunt.loadNpmTasks('grunt-contrib-csslint');
  grunt.loadNpmTasks('grunt-banner');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-html-validation');
  grunt.loadNpmTasks('grunt-hologram');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-browser-sync');

  // Default task(s).
  grunt.registerTask('default', ['sass', 'autoprefixer', 'usebanner', 'csslint', 'concat', 'jekyll:dev', 'hologram', 'browserSync', 'watch']);
  grunt.registerTask('validate', ['sass', 'autoprefixer', 'usebanner', 'csslint', 'concat', 'jekyll:dev', 'validation']);
  grunt.registerTask('build', ['sass', 'autoprefixer', 'usebanner', 'csslint', 'concat', 'jekyll:dist', 'validation', 'hologram']);

};
<commit_msg>move sass files to a specific folder<commit_after>module.exports = function (grunt) {

  // Package configuration
  grunt.initConfig({

    // Metadata
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * <%= pkg.name %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2014-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',

    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'css/style.min.css' : '_sass/style.scss'
        }
      },
      dev: {
        options: {
          style: 'expanded'
        },
          files: {
            'css/style.css': '_sass/style.scss'
        }
      }
    },

    autoprefixer: {
      options: {
        browsers: ['last 2 versions', 'ie 8', 'ie 9'],
        map: true
      },
      dist: {
        src: 'css/style.min.css'
      },
      dev: {
        src: 'css/style.css'
      },
    },

    usebanner: {
      options: {
        position: 'bottom',
        banner: '<%= banner %>'
      },
      files: {
        src: ['css/style.min.css', 'css/style.css']
      }
    },

    csslint: {
      options: {
        csslintrc: '.csslintrc'
      },
      dist: [
        'css/style.min.css'
      ],
      dev: [
        'css/style.css'
      ]
    },

    concat: {
      options: {
        separator: ';',
        banner: '<%= banner %>',
      },
      header_js: {
        src: [
          'javascripts/_typekit.js'
        ],
        dest: 'javascripts/header.js',
      },
      footer_js: {
        src: [
          'bower_components/jquery/dist/jquery.min.js',
          'bower_components/fitvids/jquery.fitvids.js',
          'javascripts/_fitvids.footer.js',
          'javascripts/_iconic.js',
          'javascripts/_google-analytics.js'
          ],
        dest: 'javascripts/footer.js',
      },
    },

    jekyll: {                             // Task
      dist: {                             // Target
        options: {                        // Target options
          dest: '_site',
          config: '_config.yml'
        }
      },
      dev : {
        options : {
          dest: '_site',
          config: '_config-dev.yml'
        }
      }
    },

    validation: {
    options: {
      },
    files: {
        src: ['_site/*.html']
      }
    },

    hologram: {
      generate: {
        options: {
          config: 'hologram_config.yml'
        }
      }
    },

    watch: {
      sass: {
        files: '_sass/**/*.scss',
        tasks: ['sass','autoprefixer',  'usebanner', 'csslint', 'hologram']
      },
      js: {
        files: 'javascripts/**/*.js',
        tasks: ['concat', 'hologram']
      },
      hologram: {
        files: 'css/*.md',
        tasks: ['hologram']
      },
      jekyll: {
        files: ['index.html', '*.html', '*.md', '_data/*.*', '_layouts/*.html', '_includes/*.html', '_posts/*.*', 'css/*.css','javascripts/*.js'],
        tasks: ['jekyll:dev', 'validation']
      }
    },

    browserSync: {
      files: {
        src : ['_site/css/*.css', '_site/*.html', '_site/<%= grunt.template.today("yyyy") %>/**/*.html']
      },
      options: {
        watchTask: true,
        ghostMode: {
          clicks: true,
          scroll: true,
          links: true,
          forms: true
        },
        server: {
          baseDir: '_site'
        }
      }
    },

  });

  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-autoprefixer');
  grunt.loadNpmTasks('grunt-contrib-csslint');
  grunt.loadNpmTasks('grunt-banner');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-html-validation');
  grunt.loadNpmTasks('grunt-hologram');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-browser-sync');

  // Default task(s).
  grunt.registerTask('default', ['sass', 'autoprefixer', 'usebanner', 'concat', 'jekyll:dev', 'hologram', 'browserSync', 'watch']);
  grunt.registerTask('validate', ['sass', 'autoprefixer', 'usebanner', 'csslint', 'concat', 'jekyll:dev', 'validation']);
  grunt.registerTask('build', ['sass', 'autoprefixer', 'usebanner', 'csslint', 'concat', 'jekyll:dist', 'validation', 'hologram']);

};
<|endoftext|>