<commit_before>module.exports = function (grunt) {
    "use strict";
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        less: {
            publish: {
                options: {
                    compress: false,
                    optimization: 2
                },
                files: {
                    "public/apps/widgets/gc2map/css/styles.css": "public/apps/widgets/gc2map/less/styles.less"
                }
            }
        },
        cssmin: {
            build: {
                files: {
                    // The Viewer
                    'public/apps/viewer/css/build/all.min.css': [
                        'public/js/bootstrap3/css/bootstrap.min.css',
                        'public/js/MultiLevelPushMenu/jquery.multilevelpushmenu.css',
                        'public/apps/viewer/css/styles.css'
                    ],
                    // Admin
                    'public/css/build/styles.min.css': [
                        //'public/js/ext/examples/ux/superboxselect/superboxselect.css',
                        //'public/js/ext/resources/css/ext-all-notheme.css',
                        //'public/js/ext/resources/css/xtheme-dark.css',
                        //'public/js/ext/examples/ux/gridfilters/css/GridFilters.css',
                        //'public/js/ext/examples/ux/gridfilters/css/RangeMenu.css',
                        'public/js/bootstrap/css/bootstrap.icons.min.css',
                        'public/css/jquery.plupload.queue.css',
                        'public/css/styles.css'
                    ],
                    // The widget
                    'public/apps/widgets/gc2map/css/build/all.min.css': [
                        'public/apps/widgets/gc2map/css/styles.css',
                        'public/js/leaflet/plugins/markercluster/MarkerCluster.css',
                        'public/js/leaflet/plugins/markercluster/MarkerCluster.Default.css'
                    ]
                }
            }
        },
        jshint: {
            options: {
                funcscope: true,
                shadow: true,
                evil: true,
                validthis: true,
                asi: true,
                newcap: false,
                notypeof: false,
                eqeqeq: false,
                loopfunc: true,
                devel: false,
                eqnull: true
            },
            all: ['public/js/*.js']
        },
        uglify: {
            //adhoc: {files: {'public/js/openlayers/OpenLayers.js': ['public/js/openlayers/OpenLayers.js']}},
            options: {
                mangle: false,
                compress : false
            },
            publish: {
                files: {
                    'public/js/leaflet/leaflet-plugins-all.js': [
                        'public/js/leaflet/plugins/markercluster/leaflet.markercluster-src.js',
                        'public/js/leaflet/plugins/Leaflet.heat/leaflet-heat.js',
                        'public/js/leaflet/plugins/Leaflet.draw/leaflet.draw.js',
                        'public/js/leaflet/plugins/Leaflet.label/leaflet.label.js',
                        'public/js/leaflet/plugins/Leaflet.print/leaflet.print-src.js',
                        'public/js/leaflet/plugins/Leaflet.Editable/Leaflet.Editable.js',
                        'public/js/leaflet/plugins/Leaflet.GraphicScale/Leaflet.GraphicScale.min.js',
                        'public/js/leaflet/plugins/Leaflet.Locate/Leaflet.Locate.js',
                        'public/js/leaflet/plugins/Leaflet.Toolbar/leaflet.toolbar-src.js'
                    ],
                    'public/js/leaflet/cartodb-all.js': [
                        'public/js/cartodbjs/cartodb.uncompressed.js',
                        'public/js/leaflet/leaflet-plugins-all.js'
                    ],
                    'public/js/leaflet/leaflet-all.js': [
                        'public/js/leaflet/leaflet-0.7.7-src.js',
                        'public/js/leaflet/leaflet-plugins-all.js'
                    ],
                    // geocloud.js
                    'public/api/v3/js/geocloud.min.js': ['public/api/v3/js/geocloud.js'],
                    // The Viewer
                    'public/apps/viewer/js/build/all.min.js': [
                        'public/js/jquery/1.10.0/jquery.min.js',
                        'public/js/bootstrap3/js/bootstrap.min.js',
                        'public/js/hogan/hogan-2.0.0.js',
                        'public/js/div/jRespond.js',
                        'public/js/admin/common.js',
                        'public/js/MultiLevelPushMenu/jquery.multilevelpushmenu.js',
                        'public/apps/viewer/js/templates.js',
                        'public/apps/viewer/js/viewer.js',
                        'public/js/leaflet/leaflet-all.js'
                    ],
                    //admin
                    'public/js/admin/build/all.min.js': [
                        'public/js/canvasResize/binaryajax.js',
                        'public/js/canvasResize/exif.js',
                        'public/js/canvasResize/canvasResize.js',

                        'public/js/ext/adapter/ext/ext-base-debug.js',
                        'public/js/ext/ext-all-debug.js',
                        'public/js/ext/examples/ux/Spinner.js',
                        'public/js/ext/examples/ux/SpinnerField.js',
                        'public/js/ext/examples/ux/CheckColumn.js',
                        'public/js/ext/examples/ux/gridfilters/menu/RangeMenu.js',
                        'public/js/ext/examples/ux/gridfilters/menu/ListMenu.js',
                        'public/js/ext/examples/ux/superboxselect/SuperBoxSelect.js',
                        'public/js/ext/examples/ux/gridfilters/GridFilters.js',
                        'public/js/ext/examples/ux/gridfilters/filter/Filter.js',
                        'public/js/ext/examples/ux/gridfilters/filter/StringFilter.js',

                        'public/js/jquery/1.10.0/jquery.min.js',
                        'public/js/openlayers/proj4js-combined.js',
                        'public/js/GeoExt/script/GeoExt.js',
                        'public/js/plupload/js/moxie.min.js',
                        'public/js/plupload/js/plupload.min.js',
                        'public/js/plupload/js/jquery.plupload.queue/jquery.plupload.queue.min.js',

                        'public/js/admin/msg.js',
                        'public/js/admin/admin.js',
                        'public/js/admin/edittablestructure.js',
                        'public/js/admin/elasticsearchmapping.js',
                        'public/js/admin/editwmsclass.js',
                        'public/js/admin/editwmslayer.js',
                        'public/js/admin/edittilelayer.js',
                        'public/js/admin/classwizards.js',
                        'public/js/admin/addshapeform.js',
                        'public/js/admin/addbitmapform.js',
                        'public/js/admin/addrasterform.js',
                        'public/js/admin/addfromscratch.js',
                        'public/js/admin/addviewform.js',
                        'public/js/admin/addosmform.js',
                        'public/js/admin/addqgisform.js',
                        'public/js/admin/colorfield.js',
                        'public/js/admin/httpauthform.js',
                        'public/js/admin/apikeyform.js',
                        'public/js/admin/attributeform.js',
                        'public/js/admin/filterfield.js',
                        'public/js/admin/filterbuilder.js',
                        'public/js/admin/comparisoncomboBox.js',
                        'public/js/openlayers/defs/EPSG3857.js'
                    ],

                    // The widget
                    'public/apps/widgets/gc2map/js/build/all.min.js': [
                        'public/js/leaflet/leaflet-all.js',
                        'public/js/openlayers/proj4js-combined.js',
                        'public/js/bootstrap3/js/bootstrap.min.js',
                        'public/js/hogan/hogan-2.0.0.js',
                        'public/apps/widgets/gc2map/js/bootstrap-alert.js',
                        'public/api/v3/js/geocloud.js',
                        'public/apps/widgets/gc2map/js/main.js',
                        'public/apps/widgets/gc2map/js/templates.js',
                        'public/apps/widgets/gc2map/config/config.js'
                    ]
                }
            },
            devel: {
                files: {
                    // The widget
                    'public/apps/widgets/gc2map/js/build/all.min.js': [
                        'public/js/leaflet/leaflet-all.js',
                        'public/js/openlayers/proj4js-combined.js',
                        'public/js/bootstrap3/js/bootstrap.min.js',
                        'public/js/hogan/hogan-2.0.0.js',
                        'public/apps/widgets/gc2map/js/bootstrap-alert.js',
                        'public/api/v3/js/geocloud.js',
                        'public/apps/widgets/gc2map/js/main.js',
                        'public/apps/widgets/gc2map/js/templates.js',
                        'public/apps/widgets/gc2map/config/config.js'
                    ]
                }
            }
        },
        hogan: {
            publish: {
                options: {
                    defaultName: function (filename) {
                        return filename.split('/').pop();
                    }
                },
                files: {
                    "public/apps/viewer/js/templates.js": ["public/apps/viewer/templates/body.tmpl"],
                    "public/apps/widgets/gc2map/js/templates.js": [
                        "public/apps/widgets/gc2map/templates/body.tmpl",
                        "public/apps/widgets/gc2map/templates/body2.tmpl"
                    ]
                }
            }
        },
        cacheBust: {
            options: {
                encoding: 'utf8',
                algorithm: 'md5',
                length: 16,
                rename: false,
                enableUrlFragmentHint: true,
                baseDir: "public/",
                ignorePatterns: ['php']
            },
            assets: {
                files: [{
                    src: [
                        'public/admin.php',
                        'public/apps/viewer/index.html',
                        'public/apps/widgets/gc2map/index.html',
                        'public/api/v3/js/async_loader.js',
                        'public/api/v3/js/geocloud.js',
                        'public/apps/widgets/gc2map/js/gc2map.js'
                    ]
                }]
            }
        },
        processhtml: {
            dist: {
                files: {
                    'public/admin.php': ['public/admin.php'],
                    'public/apps/viewer/index.html': ['public/apps/viewer/index.html']
                }
            }
        },
        preprocess: {
            debug: {
                options: {
                    context: {
                        DEBUG: true
                    }
                },
                files: {
                    "public/apps/widgets/gc2map/js/gc2map.js": "public/apps/widgets/gc2map/js/gc2map.preprocessed.js",
                    "public/api/v3/js/async_loader.js": "public/api/v3/js/async_loader.preprocessed.js"
                }
            },
            production: {
                options: {
                    context: {
                        DEBUG: false
                    }
                },
                files: {
                    "public/apps/widgets/gc2map/js/gc2map.js": "public/apps/widgets/gc2map/js/gc2map.preprocessed.js",
                    "public/api/v3/js/async_loader.js": "public/api/v3/js/async_loader.preprocessed.js"
                }
            }
        },
        gitpull: {
            production: {
                options: {}
            }
        },
        gitreset: {
            production: {
                options: {
                    mode: 'hard'
                }
            }
        },
        shell: {
            migration: {
                command: 'cd /var/www/geocloud2/app/conf/migration/ && ./run'
            },
            move_bitmaps: {
                command: 'cd /var/www/geocloud2/app/conf/migration/ && ./move_bitmaps'
            },
            chown: {
                command: 'chown www-data:www-data -R /var/www/geocloud2/app/wms/files'
            },
            composer: {
                command: 'cd app && php composer.phar install'
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-processhtml');
    grunt.loadNpmTasks('grunt-templates-hogan');
    grunt.loadNpmTasks('grunt-cache-bust');
    grunt.loadNpmTasks('grunt-preprocess');
    grunt.loadNpmTasks('grunt-git');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-npm-install');
    grunt.loadNpmTasks('grunt-contrib-less');

    grunt.registerTask('default', ['npm-install', 'less', 'cssmin', 'jshint', 'hogan', 'preprocess:debug', 'cacheBust']);
    grunt.registerTask('production', ['gitreset', 'gitpull', 'npm-install', 'less', 'cssmin', 'hogan', 'uglify', 'processhtml', 'preprocess:production', 'cacheBust', 'shell:move_bitmaps', 'shell:chown', 'shell:composer']);
    grunt.registerTask('migration', ['shell:migration']);
};

<commit_msg>Leaflet 1.2 bundle added<commit_after>module.exports = function (grunt) {
    "use strict";
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        less: {
            publish: {
                options: {
                    compress: false,
                    optimization: 2
                },
                files: {
                    "public/apps/widgets/gc2map/css/styles.css": "public/apps/widgets/gc2map/less/styles.less"
                }
            }
        },
        cssmin: {
            build: {
                files: {
                    // The Viewer
                    'public/apps/viewer/css/build/all.min.css': [
                        'public/js/bootstrap3/css/bootstrap.min.css',
                        'public/js/MultiLevelPushMenu/jquery.multilevelpushmenu.css',
                        'public/apps/viewer/css/styles.css'
                    ],
                    // Admin
                    'public/css/build/styles.min.css': [
                        //'public/js/ext/examples/ux/superboxselect/superboxselect.css',
                        //'public/js/ext/resources/css/ext-all-notheme.css',
                        //'public/js/ext/resources/css/xtheme-dark.css',
                        //'public/js/ext/examples/ux/gridfilters/css/GridFilters.css',
                        //'public/js/ext/examples/ux/gridfilters/css/RangeMenu.css',
                        'public/js/bootstrap/css/bootstrap.icons.min.css',
                        'public/css/jquery.plupload.queue.css',
                        'public/css/styles.css'
                    ],
                    // The widget
                    'public/apps/widgets/gc2map/css/build/all.min.css': [
                        'public/apps/widgets/gc2map/css/styles.css',
                        'public/js/leaflet/plugins/markercluster/MarkerCluster.css',
                        'public/js/leaflet/plugins/markercluster/MarkerCluster.Default.css'
                    ]
                }
            }
        },
        jshint: {
            options: {
                funcscope: true,
                shadow: true,
                evil: true,
                validthis: true,
                asi: true,
                newcap: false,
                notypeof: false,
                eqeqeq: false,
                loopfunc: true,
                devel: false,
                eqnull: true
            },
            all: ['public/js/*.js']
        },
        uglify: {
            //adhoc: {files: {'public/js/openlayers/OpenLayers.js': ['public/js/openlayers/OpenLayers.js']}},
            options: {
                mangle: false,
                compress : false
            },
            publish: {
                files: {
                    'public/js/leaflet/leaflet-plugins-all.js': [
                        'public/js/leaflet/plugins/markercluster/leaflet.markercluster-src.js',
                        'public/js/leaflet/plugins/Leaflet.heat/leaflet-heat.js',
                        'public/js/leaflet/plugins/Leaflet.draw/leaflet.draw.js',
                        'public/js/leaflet/plugins/Leaflet.label/leaflet.label.js',
                        'public/js/leaflet/plugins/Leaflet.print/leaflet.print-src.js',
                        'public/js/leaflet/plugins/Leaflet.Editable/Leaflet.Editable.js',
                        'public/js/leaflet/plugins/Leaflet.GraphicScale/Leaflet.GraphicScale.min.js',
                        'public/js/leaflet/plugins/Leaflet.Locate/Leaflet.Locate.js',
                        'public/js/leaflet/plugins/Leaflet.Toolbar/leaflet.toolbar-src.js'
                    ],
                    'public/js/leaflet/cartodb-all.js': [
                        'public/js/cartodbjs/cartodb.uncompressed.js',
                        'public/js/leaflet/leaflet-plugins-all.js'
                    ],
                    'public/js/leaflet/leaflet-all.js': [
                        'public/js/leaflet/leaflet-0.7.7-src.js',
                        'public/js/leaflet/leaflet-plugins-all.js'
                    ],
                    'public/js/leaflet1/leaflet-1.2.0-all.js': [
                        'public/js/leaflet1/leaflet.js',
                        'public/js/leaflet1/plugins/Leaflet.Draw/leaflet.draw.js',
                        'public/js/leaflet1/plugins/Leaflet.Editable/src/Leaflet.Editable.js',
                        'public/js/leaflet1/plugins/Leaflet.GraphicScale/Leaflet.GraphicScale.min.js',
                        'public/js/leaflet1/plugins/Leaflet.Locate/dist/L.Control.Locate.min.js',
                        'public/js/leaflet1/plugins/Leaflet.Toolbar/dist/leaflet.toolbar.min.js'
                    ],
                    // geocloud.js
                    'public/api/v3/js/geocloud.min.js': ['public/api/v3/js/geocloud.js'],
                    // The Viewer
                    'public/apps/viewer/js/build/all.min.js': [
                        'public/js/jquery/1.10.0/jquery.min.js',
                        'public/js/bootstrap3/js/bootstrap.min.js',
                        'public/js/hogan/hogan-2.0.0.js',
                        'public/js/div/jRespond.js',
                        'public/js/admin/common.js',
                        'public/js/MultiLevelPushMenu/jquery.multilevelpushmenu.js',
                        'public/apps/viewer/js/templates.js',
                        'public/apps/viewer/js/viewer.js',
                        'public/js/leaflet/leaflet-all.js'
                    ],
                    //admin
                    'public/js/admin/build/all.min.js': [
                        'public/js/canvasResize/binaryajax.js',
                        'public/js/canvasResize/exif.js',
                        'public/js/canvasResize/canvasResize.js',

                        'public/js/ext/adapter/ext/ext-base-debug.js',
                        'public/js/ext/ext-all-debug.js',
                        'public/js/ext/examples/ux/Spinner.js',
                        'public/js/ext/examples/ux/SpinnerField.js',
                        'public/js/ext/examples/ux/CheckColumn.js',
                        'public/js/ext/examples/ux/gridfilters/menu/RangeMenu.js',
                        'public/js/ext/examples/ux/gridfilters/menu/ListMenu.js',
                        'public/js/ext/examples/ux/superboxselect/SuperBoxSelect.js',
                        'public/js/ext/examples/ux/gridfilters/GridFilters.js',
                        'public/js/ext/examples/ux/gridfilters/filter/Filter.js',
                        'public/js/ext/examples/ux/gridfilters/filter/StringFilter.js',

                        'public/js/jquery/1.10.0/jquery.min.js',
                        'public/js/openlayers/proj4js-combined.js',
                        'public/js/GeoExt/script/GeoExt.js',
                        'public/js/plupload/js/moxie.min.js',
                        'public/js/plupload/js/plupload.min.js',
                        'public/js/plupload/js/jquery.plupload.queue/jquery.plupload.queue.min.js',

                        'public/js/admin/msg.js',
                        'public/js/admin/admin.js',
                        'public/js/admin/edittablestructure.js',
                        'public/js/admin/elasticsearchmapping.js',
                        'public/js/admin/editwmsclass.js',
                        'public/js/admin/editwmslayer.js',
                        'public/js/admin/edittilelayer.js',
                        'public/js/admin/classwizards.js',
                        'public/js/admin/addshapeform.js',
                        'public/js/admin/addbitmapform.js',
                        'public/js/admin/addrasterform.js',
                        'public/js/admin/addfromscratch.js',
                        'public/js/admin/addviewform.js',
                        'public/js/admin/addosmform.js',
                        'public/js/admin/addqgisform.js',
                        'public/js/admin/colorfield.js',
                        'public/js/admin/httpauthform.js',
                        'public/js/admin/apikeyform.js',
                        'public/js/admin/attributeform.js',
                        'public/js/admin/filterfield.js',
                        'public/js/admin/filterbuilder.js',
                        'public/js/admin/comparisoncomboBox.js',
                        'public/js/openlayers/defs/EPSG3857.js'
                    ],

                    // The widget
                    'public/apps/widgets/gc2map/js/build/all.min.js': [
                        'public/js/leaflet/leaflet-all.js',
                        'public/js/openlayers/proj4js-combined.js',
                        'public/js/bootstrap3/js/bootstrap.min.js',
                        'public/js/hogan/hogan-2.0.0.js',
                        'public/apps/widgets/gc2map/js/bootstrap-alert.js',
                        'public/api/v3/js/geocloud.js',
                        'public/apps/widgets/gc2map/js/main.js',
                        'public/apps/widgets/gc2map/js/templates.js',
                        'public/apps/widgets/gc2map/config/config.js'
                    ]
                }
            },
            devel: {
                files: {
                    // The widget
                    'public/apps/widgets/gc2map/js/build/all.min.js': [
                        'public/js/leaflet/leaflet-all.js',
                        'public/js/openlayers/proj4js-combined.js',
                        'public/js/bootstrap3/js/bootstrap.min.js',
                        'public/js/hogan/hogan-2.0.0.js',
                        'public/apps/widgets/gc2map/js/bootstrap-alert.js',
                        'public/api/v3/js/geocloud.js',
                        'public/apps/widgets/gc2map/js/main.js',
                        'public/apps/widgets/gc2map/js/templates.js',
                        'public/apps/widgets/gc2map/config/config.js'
                    ]
                }
            }
        },
        hogan: {
            publish: {
                options: {
                    defaultName: function (filename) {
                        return filename.split('/').pop();
                    }
                },
                files: {
                    "public/apps/viewer/js/templates.js": ["public/apps/viewer/templates/body.tmpl"],
                    "public/apps/widgets/gc2map/js/templates.js": [
                        "public/apps/widgets/gc2map/templates/body.tmpl",
                        "public/apps/widgets/gc2map/templates/body2.tmpl"
                    ]
                }
            }
        },
        cacheBust: {
            options: {
                encoding: 'utf8',
                algorithm: 'md5',
                length: 16,
                rename: false,
                enableUrlFragmentHint: true,
                baseDir: "public/",
                ignorePatterns: ['php']
            },
            assets: {
                files: [{
                    src: [
                        'public/admin.php',
                        'public/apps/viewer/index.html',
                        'public/apps/widgets/gc2map/index.html',
                        'public/api/v3/js/async_loader.js',
                        'public/api/v3/js/geocloud.js',
                        'public/apps/widgets/gc2map/js/gc2map.js'
                    ]
                }]
            }
        },
        processhtml: {
            dist: {
                files: {
                    'public/admin.php': ['public/admin.php'],
                    'public/apps/viewer/index.html': ['public/apps/viewer/index.html']
                }
            }
        },
        preprocess: {
            debug: {
                options: {
                    context: {
                        DEBUG: true
                    }
                },
                files: {
                    "public/apps/widgets/gc2map/js/gc2map.js": "public/apps/widgets/gc2map/js/gc2map.preprocessed.js",
                    "public/api/v3/js/async_loader.js": "public/api/v3/js/async_loader.preprocessed.js"
                }
            },
            production: {
                options: {
                    context: {
                        DEBUG: false
                    }
                },
                files: {
                    "public/apps/widgets/gc2map/js/gc2map.js": "public/apps/widgets/gc2map/js/gc2map.preprocessed.js",
                    "public/api/v3/js/async_loader.js": "public/api/v3/js/async_loader.preprocessed.js"
                }
            }
        },
        gitpull: {
            production: {
                options: {}
            }
        },
        gitreset: {
            production: {
                options: {
                    mode: 'hard'
                }
            }
        },
        shell: {
            migration: {
                command: 'cd /var/www/geocloud2/app/conf/migration/ && ./run'
            },
            move_bitmaps: {
                command: 'cd /var/www/geocloud2/app/conf/migration/ && ./move_bitmaps'
            },
            chown: {
                command: 'chown www-data:www-data -R /var/www/geocloud2/app/wms/files'
            },
            composer: {
                command: 'cd app && php composer.phar install'
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-processhtml');
    grunt.loadNpmTasks('grunt-templates-hogan');
    grunt.loadNpmTasks('grunt-cache-bust');
    grunt.loadNpmTasks('grunt-preprocess');
    grunt.loadNpmTasks('grunt-git');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-npm-install');
    grunt.loadNpmTasks('grunt-contrib-less');

    grunt.registerTask('default', ['npm-install', 'less', 'cssmin', 'jshint', 'hogan', 'preprocess:debug', 'cacheBust']);
    grunt.registerTask('production', ['gitreset', 'gitpull', 'npm-install', 'less', 'cssmin', 'hogan', 'uglify', 'processhtml', 'preprocess:production', 'cacheBust', 'shell:move_bitmaps', 'shell:chown', 'shell:composer']);
    grunt.registerTask('migration', ['shell:migration']);
};

<|endoftext|>


<commit_before> /*
  * m8tro-bootstrap
  * https://github.com/idleberg/m8tro-bootstrap
  *
  * Copyright (c) 2014 Jan T. Sott
  * Licensed under the MIT license.
  */

var concat  = require('gulp-concat');
var csslint = require('gulp-csslint');
var cssmin  = require('gulp-cssmin');
var del     = require('del');
var gulp    = require('gulp');
var htmlval = require('gulp-html-validator');
var inject  = require('gulp-inject');
var jshint  = require('gulp-jshint');
var less    = require('gulp-less');
var path    = require('path');
var util    = require('gulp-util');
var watch   = require('gulp-watch');

/*
 * Task combos
 */

gulp.task('css',     ['csslint']);
gulp.task('html',    ['htmlval']);
gulp.task('js',      ['jshint']);

gulp.task('default', ['make']);

gulp.task('lint',    ['css', 'html', 'js']);
gulp.task('make',    ['less', 'fontawesome', 'bootstrapjs']);
gulp.task('travis',  ['css', 'html']);

/*
 * Sub-tasks
 */

// HTML Page
gulp.task('htmlval', function () {
  return htmlval([
        'index.html'
    ]);
});

// Custom CSS
gulp.task('csslint', function() {
  gulp.src([
      'dist/css/*',
      '!dist/css/font-awesome.min.css'
    ])
    .pipe(csslint())
    .pipe(csslint.reporter())
});

// Custom Javascript
gulp.task('jshint', function() {
  gulp.src([
      'dist/js/*'
    ])
    .pipe(jshint())
    .pipe(jshint.reporter())
});

// LESS
gulp.task('less', ['clean'], function () {
  gulp.src('src/themes/m8tro/build.less')
    .pipe(less({
      paths: [ path.join(__dirname, 'less', 'includes') ]
    }))
    .pipe(concat('m8tro.min.css'))
    .pipe(cssmin())
    .pipe(gulp.dest('dist/css/'));
});

// Copy tasks
gulp.task('fontawesome', ['clean'], function() {
  gulp.src([
      'bower_components/fontawesome/css/font-awesome.min.css'
    ])
    .pipe(gulp.dest('dist/css/'));
  gulp.src([
      'bower_components/fontawesome/fonts/*'
    ])
    .pipe(gulp.dest('dist/fonts/'));
  gulp.src([
      'bower_components/jquery/dist/jquery.min.js'
    ])
    .pipe(gulp.dest('dist/js/'));
});

gulp.task('bootstrapjs', ['clean'], function() {
  gulp.src([
      'bower_components/bootstrap/dist/js/bootstrap.min.js'
    ])
    .pipe(gulp.dest('dist/js/'));
});

// Cleaning task
gulp.task('clean', function () {
    del([
      'dist/'
    ])
});

// Injection task
gulp.task('local', function () {
  var target = gulp.src('index.html');
  var sources = gulp.src(['dist/css/*','src/js/*'], {read: false});

  return target.pipe(inject(sources))
    .pipe(gulp.dest(''));
});

// Watch task
gulp.task('watch', function () {
   gulp.watch([
            'dist/**/*',
            'index.html'
         ],
         ['lint'])
});<commit_msg>modified clean task<commit_after> /*
  * m8tro-bootstrap
  * https://github.com/idleberg/m8tro-bootstrap
  *
  * Copyright (c) 2014 Jan T. Sott
  * Licensed under the MIT license.
  */

var concat  = require('gulp-concat');
var csslint = require('gulp-csslint');
var cssmin  = require('gulp-cssmin');
var del     = require('del');
var gulp    = require('gulp');
var htmlval = require('gulp-html-validator');
var inject  = require('gulp-inject');
var jshint  = require('gulp-jshint');
var less    = require('gulp-less');
var path    = require('path');
var util    = require('gulp-util');
var watch   = require('gulp-watch');

/*
 * Task combos
 */

gulp.task('css',     ['csslint']);
gulp.task('html',    ['htmlval']);
gulp.task('js',      ['jshint']);

gulp.task('default', ['make']);

gulp.task('lint',    ['css', 'html', 'js']);
gulp.task('make',    ['less', 'fontawesome', 'bootstrapjs']);
gulp.task('travis',  ['css', 'html']);

/*
 * Sub-tasks
 */

// HTML Page
gulp.task('htmlval', function () {
  return htmlval([
        'index.html'
    ]);
});

// Custom CSS
gulp.task('csslint', function() {
  gulp.src([
      'dist/css/*',
      '!dist/css/font-awesome.min.css'
    ])
    .pipe(csslint())
    .pipe(csslint.reporter())
});

// Custom Javascript
gulp.task('jshint', function() {
  gulp.src([
      'dist/js/*'
    ])
    .pipe(jshint())
    .pipe(jshint.reporter())
});

// LESS
gulp.task('less', ['clean'], function () {
  gulp.src('src/themes/m8tro/build.less')
    .pipe(less({
      paths: [ path.join(__dirname, 'less', 'includes') ]
    }))
    .pipe(concat('m8tro.min.css'))
    .pipe(cssmin())
    .pipe(gulp.dest('dist/css/'));
});

// Copy tasks
gulp.task('fontawesome', ['clean'], function() {
  gulp.src([
      'bower_components/fontawesome/css/font-awesome.min.css'
    ])
    .pipe(gulp.dest('dist/css/'));
  gulp.src([
      'bower_components/fontawesome/fonts/*'
    ])
    .pipe(gulp.dest('dist/fonts/'));
  gulp.src([
      'bower_components/jquery/dist/jquery.min.js'
    ])
    .pipe(gulp.dest('dist/js/'));
});

gulp.task('bootstrapjs', ['clean'], function() {
  gulp.src([
      'bower_components/bootstrap/dist/js/bootstrap.min.js'
    ])
    .pipe(gulp.dest('dist/js/'));
});

// Cleaning task
gulp.task('clean', function () {
    return del([
      'dist/**/*'
    ])
});

// Injection task
gulp.task('local', function () {
  var target = gulp.src('index.html');
  var sources = gulp.src(['dist/css/*','src/js/*'], {read: false});

  return target.pipe(inject(sources))
    .pipe(gulp.dest(''));
});

// Watch task
gulp.task('watch', function () {
   gulp.watch([
            'dist/**/*',
            'index.html'
         ],
         ['lint'])
});<|endoftext|>


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

    /* Task configuration */

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        watch: {

            src: {

                files: [ 'Gruntfile.js', 'src/**/*.js' ],
                tasks: [ 'jshint:src', 'build' ],

            },

            spec: {

                files: 'spec/**/*.js',
                tasks: 'jshint:spec',

            }
        },

        concat: {

            dist: {

                src: [ 'src/tmc-web-client.js', 'src/*.js' ],
                dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js',
                options: {

                    separator: ';'

                }
            }
        },

        uglify: {

            dist: {

                files: {

                    'dist/<%= pkg.name %>-<%= pkg.version %>-min.js': 'dist/<%= pkg.name %>-<%= pkg.version %>.js'

                },

                options: {

                    report: 'min'

                }
            }
        },

        jshint: {

            src: {

                src: [ 'Gruntfile.js', 'src/**/*.js' ],
                options: {

                    jshintrc: 'jshint.json'

                }
            },

            spec: {

                src: 'spec/**/*.js',
                options: {

                    jshintrc: 'spec/jshint.json'

                }
            }
        },

        jasmine: {

            src: [ 'src/tmc-web-client.js', 'src/*.js' ],
            options: {

                specs: 'spec/**/*-spec.js',
                template: require('grunt-template-jasmine-istanbul'),
                templateOptions: {

                    coverage: 'coverage/coverage.json',
                    report: {

                        type: 'lcov',
                        options: {

                            dir: 'coverage/'

                        }
                    }
                }
            }
        },

        sass: {

            dist: {

                files: {

                    'demo/assets/css/tmc-web-client.css': 'src/css/tmc-web-client.scss'

                }
            }
        },

        copy: {

            assets: {

                expand: true,
                flatten: true,
                src: 'dist/*.js',
                dest: 'demo/assets/js/',
                filter: 'isFile'

            }
        }
    });

    /* Load tasks */

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-copy');

    /* Register tasks */

    grunt.registerTask('test', [ 'jshint', 'jasmine' ]);
    grunt.registerTask('build', [ 'concat', 'uglify', 'sass', 'copy' ]);
    grunt.registerTask('default', [ 'test', 'build' ]);
}
<commit_msg>Cohesive paths<commit_after>module.exports = function (grunt) {

    /* Task configuration */

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        watch: {

            src: {

                files: [ 'Gruntfile.js', 'src/**/*.js' ],
                tasks: [ 'jshint:src', 'build' ],

            },

            spec: {

                files: 'spec/**/*.js',
                tasks: 'jshint:spec',

            }
        },

        concat: {

            dist: {

                src: [ 'src/tmc-web-client.js', 'src/**/*.js' ],
                dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js',
                options: {

                    separator: ';'

                }
            }
        },

        uglify: {

            dist: {

                files: {

                    'dist/<%= pkg.name %>-<%= pkg.version %>-min.js': 'dist/<%= pkg.name %>-<%= pkg.version %>.js'

                },

                options: {

                    report: 'min'

                }
            }
        },

        jshint: {

            src: {

                src: [ 'Gruntfile.js', 'src/**/*.js' ],
                options: {

                    jshintrc: 'jshint.json'

                }
            },

            spec: {

                src: 'spec/**/*.js',
                options: {

                    jshintrc: 'spec/jshint.json'

                }
            }
        },

        jasmine: {

            src: [ 'src/tmc-web-client.js', 'src/**/*.js' ],
            options: {

                specs: 'spec/**/*-spec.js',
                template: require('grunt-template-jasmine-istanbul'),
                templateOptions: {

                    coverage: 'coverage/coverage.json',
                    report: {

                        type: 'lcov',
                        options: {

                            dir: 'coverage/'

                        }
                    }
                }
            }
        },

        sass: {

            dist: {

                files: {

                    'demo/assets/css/tmc-web-client.css': 'src/css/tmc-web-client.scss'

                }
            }
        },

        copy: {

            assets: {

                expand: true,
                flatten: true,
                src: 'dist/*.js',
                dest: 'demo/assets/js/',
                filter: 'isFile'

            }
        }
    });

    /* Load tasks */

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-copy');

    /* Register tasks */

    grunt.registerTask('test', [ 'jshint', 'jasmine' ]);
    grunt.registerTask('build', [ 'concat', 'uglify', 'sass', 'copy' ]);
    grunt.registerTask('default', [ 'test', 'build' ]);
}
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  require("time-grunt")(grunt);
  require("grunt-lazyload")(grunt);

  grunt.lazyLoadNpmTasks("grunt-contrib-watch" ,"watch");
  grunt.lazyLoadNpmTasks("grunt-contrib-sass", "sass");
  grunt.lazyLoadNpmTasks("grunt-manifest", "manifest");
  grunt.lazyLoadNpmTasks("grunt-autoprefixer", "autoprefixer");
  grunt.lazyLoadNpmTasks("grunt-growl", "growl");
  grunt.lazyLoadNpmTasks("grunt-contrib-clean", "clean");
  grunt.lazyLoadNpmTasks("grunt-contrib-copy", "copy");
  grunt.lazyLoadNpmTasks("grunt-contrib-concat", "concat");
  grunt.lazyLoadNpmTasks("grunt-remove-logging", "removelogging");
  grunt.lazyLoadNpmTasks("grunt-contrib-uglify", "uglify");
  grunt.lazyLoadNpmTasks("grunt-contrib-cssmin", "cssmin");
  grunt.lazyLoadNpmTasks("grunt-usemin", ["useminPrepare", "usemin"]);
  grunt.lazyLoadNpmTasks("grunt-rev", "rev");
  grunt.lazyLoadNpmTasks("grunt-sed", "sed");
  grunt.lazyLoadNpmTasks("grunt-docco", "docco");
  grunt.lazyLoadNpmTasks("grunt-curl", "curl");

  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),

    watch: {
      sass: {
        options: {
          debounceDelay: 250
        },
        files: "src/sass/**",
        tasks: ["growl:sass", "sass", "growl:autoprefixer", "autoprefixer"]
      },
      manifest: {
        options: {
          debounceDelay: 250
        },
        files: ["src/index.html", "src/css/**", "src/js/**", "src/img/**", "src/sounds/**"],
        tasks: ["growl:manifest", "manifest:src"]
      }
    },

    growl: {
      sass: {
        title : "Grunt",
        message : "Sass compilation…"
      },
      autoprefixer: {
        title : "Grunt",
        message : "autoprefixer…"
      },
      manifest: {
        title : "Grunt",
        message : "Updating manifest.appcache…"
      }
    },

    sass: {
      src: {
        options: {
          style: "expanded"
        },
        files: {
          "src/css/styles.css": "src/sass/styles.scss",
          "src/css/themes/dark.css": "src/sass/themes/dark.scss"
        }
      }
    },

    autoprefixer: {
      options: {
        browsers: ["> 1%", "last 2 versions", "android >= 2"]
      },
      no_dest: {
        src: "src/css/**/*.css"
      }
    },

    clean: {
      dist: {
        src: "dist/"
      }
    },

    copy: {
      dist: {
        files: [
          {
            expand: true,
            cwd: "src/",
            src: [
              "index.html",
              ".htaccess",
              "manifest.webapp",
              "css/font/*",
              "sounds/sprite.{mp3,ogg}",
              "js/vendor/analytics.js"
            ],
            dest: "dist/"
          },
          {
            expand: true,
            cwd: "src/favicons/",
            src: "*",
            dest: "dist/"
          }
        ]
      }
    },

    useminPrepare: {
      options: {
        dest: "dist/"
      },
      html: "src/index.html"
    },
    usemin: {
      html: "dist/index.html"
    },

    concat: {
      options: {
        separator: ";"
      }
    },

    removelogging: {
      dist: {
        src: "dist/js/app.js",
        options: {}
      }
    },

    uglify: {
      options: {
        banner: "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */",
        report:"min"
      }
    },

    cssmin: {
      options: {
        banner: "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */"
      }
    },

    rev: {
      options: {
        encoding: "utf8",
        algorithm: "md5",
        length: 8
      },
      assets: {
        files: [{
          src: [
            "dist/css/styles.css",
            "dist/js/app.js"
          ]
        }]
      }
    },

    manifest: {
      src: {
        options: {
          basePath: "src/",
          network: ["*"],
          verbose: true,
          timestamp: true
        },
        src: [
          "js/**/*.js",
          "css/styles.css",
          "css/font/*",
          "sounds/*.{ogg,mp3}"
        ],
        dest: "src/manifest.appcache"
      },
      dist: {
        options: {
          basePath: "dist/",
          network: ["*"],
          verbose: true,
          timestamp: true
        },
        src: [
          "js/*.js",
          "css/*.css",
          "css/font/*",
          "sounds/*.{ogg,mp3}"
        ],
        dest: "dist/manifest.appcache"
      }
    },

    sed: {
      version: {
        path: "dist/",
        recursive: true,
        pattern: "%VERSION%",
        replacement: "<%= pkg.version %>"
      },
      description: {
        path: "dist/",
        recursive: true,
        pattern: "%DESCRIPTION%",
        replacement: "<%= pkg.description %>"
      },
      favicons: {
        path: "dist/index.html",
        pattern: "/favicons",
        replacement: ""
      }
    },

    docco: {
      debug: {
        src: ["src/js/esviji.js"],
        options: {
          output: "docs/"
        }
      }
    },

    curl: {
      google_analytics: {
        src: "http://www.google-analytics.com/analytics.js",
        dest: "src/js/vendor/analytics.js"
      },
      offline: {
        src: "https://raw2.github.com/HubSpot/offline/master/js/offline.js",
        dest: "src/js/vendor/offline.js"
      }
    }

  });

  grunt.registerTask("default", ["compile", "watch"]);
  grunt.registerTask("compile", ["growl:sass", "sass", "growl:autoprefixer", "autoprefixer", "growl:manifest", "manifest:src"]);
  grunt.registerTask("package", ["sass", "autoprefixer", "clean", "copy", "useminPrepare", "concat", "removelogging", "uglify", "cssmin", "rev", "usemin", "sed", "manifest:dist", "docco"]);
  grunt.registerTask("vendors", ["curl"]);
};
<commit_msg>concat is run by usemin<commit_after>module.exports = function(grunt) {
  require("time-grunt")(grunt);
  require("grunt-lazyload")(grunt);

  grunt.lazyLoadNpmTasks("grunt-contrib-watch" ,"watch");
  grunt.lazyLoadNpmTasks("grunt-contrib-sass", "sass");
  grunt.lazyLoadNpmTasks("grunt-manifest", "manifest");
  grunt.lazyLoadNpmTasks("grunt-autoprefixer", "autoprefixer");
  grunt.lazyLoadNpmTasks("grunt-growl", "growl");
  grunt.lazyLoadNpmTasks("grunt-contrib-clean", "clean");
  grunt.lazyLoadNpmTasks("grunt-contrib-copy", "copy");
  grunt.lazyLoadNpmTasks("grunt-contrib-concat", "concat");
  grunt.lazyLoadNpmTasks("grunt-remove-logging", "removelogging");
  grunt.lazyLoadNpmTasks("grunt-contrib-uglify", "uglify");
  grunt.lazyLoadNpmTasks("grunt-contrib-cssmin", "cssmin");
  grunt.lazyLoadNpmTasks("grunt-usemin", ["useminPrepare", "usemin"]);
  grunt.lazyLoadNpmTasks("grunt-rev", "rev");
  grunt.lazyLoadNpmTasks("grunt-sed", "sed");
  grunt.lazyLoadNpmTasks("grunt-docco", "docco");
  grunt.lazyLoadNpmTasks("grunt-curl", "curl");

  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),

    watch: {
      sass: {
        options: {
          debounceDelay: 250
        },
        files: "src/sass/**",
        tasks: ["growl:sass", "sass", "growl:autoprefixer", "autoprefixer"]
      },
      manifest: {
        options: {
          debounceDelay: 250
        },
        files: ["src/index.html", "src/css/**", "src/js/**", "src/img/**", "src/sounds/**"],
        tasks: ["growl:manifest", "manifest:src"]
      }
    },

    growl: {
      sass: {
        title : "Grunt",
        message : "Sass compilation…"
      },
      autoprefixer: {
        title : "Grunt",
        message : "autoprefixer…"
      },
      manifest: {
        title : "Grunt",
        message : "Updating manifest.appcache…"
      }
    },

    sass: {
      src: {
        options: {
          style: "expanded"
        },
        files: {
          "src/css/styles.css": "src/sass/styles.scss",
          "src/css/themes/dark.css": "src/sass/themes/dark.scss"
        }
      }
    },

    autoprefixer: {
      options: {
        browsers: ["> 1%", "last 2 versions", "android >= 2"]
      },
      no_dest: {
        src: "src/css/**/*.css"
      }
    },

    clean: {
      dist: {
        src: "dist/"
      }
    },

    copy: {
      dist: {
        files: [
          {
            expand: true,
            cwd: "src/",
            src: [
              "index.html",
              ".htaccess",
              "manifest.webapp",
              "css/font/*",
              "sounds/sprite.{mp3,ogg}",
              "js/vendor/analytics.js"
            ],
            dest: "dist/"
          },
          {
            expand: true,
            cwd: "src/favicons/",
            src: "*",
            dest: "dist/"
          }
        ]
      }
    },

    useminPrepare: {
      options: {
        dest: "dist/"
      },
      html: "src/index.html"
    },
    usemin: {
      html: "dist/index.html"
    },

    concat: {
      options: {
        separator: ";"
      }
    },

    removelogging: {
      dist: {
        src: "dist/js/app.js",
        options: {}
      }
    },

    uglify: {
      options: {
        banner: "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */",
        report:"min"
      }
    },

    cssmin: {
      options: {
        banner: "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */"
      }
    },

    rev: {
      options: {
        encoding: "utf8",
        algorithm: "md5",
        length: 8
      },
      assets: {
        files: [{
          src: [
            "dist/css/styles.css",
            "dist/js/app.js"
          ]
        }]
      }
    },

    manifest: {
      src: {
        options: {
          basePath: "src/",
          network: ["*"],
          verbose: true,
          timestamp: true
        },
        src: [
          "js/**/*.js",
          "css/styles.css",
          "css/font/*",
          "sounds/*.{ogg,mp3}"
        ],
        dest: "src/manifest.appcache"
      },
      dist: {
        options: {
          basePath: "dist/",
          network: ["*"],
          verbose: true,
          timestamp: true
        },
        src: [
          "js/*.js",
          "css/*.css",
          "css/font/*",
          "sounds/*.{ogg,mp3}"
        ],
        dest: "dist/manifest.appcache"
      }
    },

    sed: {
      version: {
        path: "dist/",
        recursive: true,
        pattern: "%VERSION%",
        replacement: "<%= pkg.version %>"
      },
      description: {
        path: "dist/",
        recursive: true,
        pattern: "%DESCRIPTION%",
        replacement: "<%= pkg.description %>"
      },
      favicons: {
        path: "dist/index.html",
        pattern: "/favicons",
        replacement: ""
      }
    },

    docco: {
      debug: {
        src: ["src/js/esviji.js"],
        options: {
          output: "docs/"
        }
      }
    },

    curl: {
      google_analytics: {
        src: "http://www.google-analytics.com/analytics.js",
        dest: "src/js/vendor/analytics.js"
      },
      offline: {
        src: "https://raw2.github.com/HubSpot/offline/master/js/offline.js",
        dest: "src/js/vendor/offline.js"
      }
    }

  });

  grunt.registerTask("default", ["compile", "watch"]);
  grunt.registerTask("compile", ["growl:sass", "sass", "growl:autoprefixer", "autoprefixer", "growl:manifest", "manifest:src"]);
  grunt.registerTask("package", ["sass", "autoprefixer", "clean", "copy", "useminPrepare", "removelogging", "uglify", "cssmin", "rev", "usemin", "sed", "manifest:dist", "docco"]);
  grunt.registerTask("vendors", ["curl"]);
};
<|endoftext|>


<commit_before>var gulp = require('gulp'),
	rename = require("gulp-rename"),
	uglify = require('gulp-uglify'),
	include = require("gulp-include"),
	browserSync = require('browser-sync'),
	reload = browserSync.reload;

var postcss = require('gulp-postcss'),
	sass = require('gulp-sass'),
	cssImport = require('postcss-import'),
	autoprefixer = require('autoprefixer'),
	cssnext = require('gulp-cssnext'),
	mqpacker = require('css-mqpacker'),
	cssnano = require('cssnano'),
	sourcemaps = require('gulp-sourcemaps'),
	pixrem = require('pixrem');

gulp.task('css', function(){
	var processors = [
		cssImport,
		autoprefixer({browsers: ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4']}),
		mqpacker,
		pixrem,
		cssnano
	];
	return gulp.src('./sass/style.sass')
		.pipe(sass().on('error', sass.logError))
		.pipe(cssnext({compress: true }))
		.pipe(postcss(processors))
		.pipe(rename('style.min.css'))
		.pipe(gulp.dest('./css'));
});

gulp.task('js', function(){
	return gulp.src('./js/global.js')
		.pipe(include()).on('error', console.log)
		.pipe(rename('global.min.js'))
		.pipe(uglify())
		.pipe(gulp.dest('./js'))
    		.pipe(reload({stream:true}));
});

gulp.task('serve', function(){
	browserSync({
		server: {
			baseDir: "./"
		}
	});
});

gulp.task('watch', function(){
	gulp.watch('./css/**/*.css', ['css', browserSync.reload]);
	gulp.watch('./js/**/*.js', ['js', browserSync.reload]);
	gulp.watch('*.html', browserSync.reload);
});

gulp.task('default', ['css', 'serve', 'js', 'watch']);
<commit_msg>cssnano: discard all comment<commit_after>var gulp = require('gulp'),
	rename = require("gulp-rename"),
	uglify = require('gulp-uglify'),
	include = require("gulp-include"),
	browserSync = require('browser-sync'),
	reload = browserSync.reload;

var postcss = require('gulp-postcss'),
	sass = require('gulp-sass'),
	cssImport = require('postcss-import'),
	autoprefixer = require('autoprefixer'),
	cssnext = require('gulp-cssnext'),
	mqpacker = require('css-mqpacker'),
	cssnano = require('cssnano'),
	sourcemaps = require('gulp-sourcemaps'),
	pixrem = require('pixrem');

gulp.task('css', function(){
	var processors = [
		cssImport,
		autoprefixer({browsers: ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4']}),
		mqpacker,
		pixrem,
		cssnano({"discardComments": {"removeAll": true}})
	];
	return gulp.src('./sass/style.sass')
		.pipe(sass().on('error', sass.logError))
		.pipe(cssnext({compress: true }))
		.pipe(postcss(processors))
		.pipe(rename('style.min.css'))
		.pipe(gulp.dest('./css'));
});

gulp.task('js', function(){
	return gulp.src('./js/global.js')
		.pipe(include()).on('error', console.log)
		.pipe(rename('global.min.js'))
		.pipe(uglify())
		.pipe(gulp.dest('./js'))
    		.pipe(reload({stream:true}));
});

gulp.task('serve', function(){
	browserSync({
		server: {
			baseDir: "./"
		}
	});
});

gulp.task('watch', function(){
	gulp.watch('./css/**/*.css', ['css', browserSync.reload]);
	gulp.watch('./js/**/*.js', ['js', browserSync.reload]);
	gulp.watch('*.html', browserSync.reload);
});

gulp.task('default', ['css', 'serve', 'js', 'watch']);
<|endoftext|>


<commit_before>/*
|--------------------------------------------------------------------------
| Include Dependencies
|--------------------------------------------------------------------------
|
*/

var gulp = require('gulp');
var watch = require('gulp-watch');
var stylus = require('gulp-stylus');
var connect = require('gulp-connect-php');
var browserSync = require('browser-sync');
var sourcemaps = require('gulp-sourcemaps');

/*
|--------------------------------------------------------------------------
| Variables
|--------------------------------------------------------------------------
|
*/

/* css */
var css_source = './resources/assets/css/app.styl';
var css_dest = './public/assets/css';

/*
|--------------------------------------------------------------------------
| Watch
|--------------------------------------------------------------------------
|
*/

gulp.task('watch', function() {
  gulp.watch(css_source, [browserSync.reload]);
  gulp.watch('**/*.php', [browserSync.reload]);
});

/*
|--------------------------------------------------------------------------
| Browser Sync
|--------------------------------------------------------------------------
|
*/

gulp.task('browser-sync',['php-server'], function() {
    browserSync({
        proxy: '127.0.0.1:8000',
        port: 8000,
        open: true,
        notify: false
    });
});

/*
|--------------------------------------------------------------------------
| PHP Server
|--------------------------------------------------------------------------
|
*/

gulp.task('php-server', function() {
  connect.server({
  	port: 8000,
  	base: './public/',
  	hostname: '127.0.0.1'
  });
});

/*
|--------------------------------------------------------------------------
| Compile Stylus
|--------------------------------------------------------------------------
|
*/

gulp.task('compile-css', function () {
  return gulp.src(css_source)
  	.pipe(sourcemaps.init())
    .pipe(stylus({
      compress: true
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(css_dest));
});

/*
|--------------------------------------------------------------------------
| Register Default Task
|--------------------------------------------------------------------------
|
*/

gulp.task('default', ['compile-css', 'browser-sync', 'watch']);

 <commit_msg>Allow any .styl file to be compiled<commit_after>/*
|--------------------------------------------------------------------------
| Include Dependencies
|--------------------------------------------------------------------------
|
*/

var gulp = require('gulp');
var watch = require('gulp-watch');
var stylus = require('gulp-stylus');
var connect = require('gulp-connect-php');
var browserSync = require('browser-sync');
var sourcemaps = require('gulp-sourcemaps');

/*
|--------------------------------------------------------------------------
| Variables
|--------------------------------------------------------------------------
|
*/

/* css */
var css_source = './resources/assets/css/**/*.styl';
var css_dest = './public/assets/css';

/*
|--------------------------------------------------------------------------
| Watch
|--------------------------------------------------------------------------
|
*/

gulp.task('watch', function() {
  gulp.watch(css_source, [browserSync.reload]);
  gulp.watch('**/*.php', [browserSync.reload]);
});

/*
|--------------------------------------------------------------------------
| Browser Sync
|--------------------------------------------------------------------------
|
*/

gulp.task('browser-sync',['php-server'], function() {
    browserSync({
        proxy: '127.0.0.1:8000',
        port: 8000,
        open: true,
        notify: false
    });
});

/*
|--------------------------------------------------------------------------
| PHP Server
|--------------------------------------------------------------------------
|
*/

gulp.task('php-server', function() {
  connect.server({
  	port: 8000,
  	base: './public/',
  	hostname: '127.0.0.1'
  });
});

/*
|--------------------------------------------------------------------------
| Compile Stylus
|--------------------------------------------------------------------------
|
*/

gulp.task('compile-css', function () {
  return gulp.src(css_source)
  	.pipe(sourcemaps.init())
    .pipe(stylus({
      compress: true
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(css_dest));
});

/*
|--------------------------------------------------------------------------
| Register Default Task
|--------------------------------------------------------------------------
|
*/

gulp.task('default', ['compile-css', 'browser-sync', 'watch']);

 <|endoftext|>


<commit_before>module.exports = function (grunt) {
  require("load-grunt-tasks")(grunt);
  grunt.registerTask("build", "to build", ["clean", "copy", "peg", "ts", "dist"]);
  grunt.registerTask("dist", "to make distribution version", ["browserify", "babel", "uglify"]);
  grunt.registerTask("default", "to watch & compile", ["build", "watch"]);
  grunt.registerTask("test", "to test", ["mochaTest"]);
  const pkg = grunt.file.readJSON("package.json");
  return grunt.initConfig({
    pkg,

    copy: {
      build: {
        cwd: "src",
        src: ["**/*.js"],
        dest: "lib",
        expand: true
      }
    },

    clean: {
      build: {
        src: ["lib", "dist"]
      }
    },

    browserify: {
      dist: {
        files: {
          "dist/JSCPP.js": ["lib/**/*.js"]
        }
      }
    },

    uglify: {
      dist: {
        files: {
          "dist/JSCPP.es5.min.js": ["dist/JSCPP.es5.js"]
        }
      }
    },

    babel: {
      options: {
        sourceMap: true,
        presets: ['@babel/preset-env']
      },
      dist: {
        files: {
          'dist/JSCPP.es5.js': 'dist/JSCPP.js'
        }
      }
    },

    concat: {
      options: {
        separator: ";"
      },
      dist: {
        src: ["node_modules/traceur/bin/traceur-runtime.js", "dist/JSCPP.es5.js"],
        dest: "dist/JSCPP.es5.js"
      }
    },

    peg: {
      build: {
        cwd: "pegjs",
        src: ["**/*.pegjs"],
        dest: "src",
        ext: ".js",
        expand: true
      }
    },

    ts: {
      default: {
        src: ["src/**/*.ts"],
        outDir: "lib/",
        options: {
          rootDir: "src",
          additionalFlags: "--downlevelIteration"
        }
      }
    },

    watch: {
      peg: {
        files: "pegjs/**/*.pegjs",
        tasks: ["newer:peg"]
      },
      copy: {
        files: ["src/**/*.js"],
        tasks: ["newer:copy"]
      }
    }
  });
};
<commit_msg>fix travis build<commit_after>module.exports = function (grunt) {
  require("load-grunt-tasks")(grunt);
  grunt.registerTask("build", "to build", ["clean", "peg", "copy", "ts", "dist"]);
  grunt.registerTask("dist", "to make distribution version", ["browserify", "babel", "uglify"]);
  grunt.registerTask("default", "to watch & compile", ["build", "watch"]);
  grunt.registerTask("test", "to test", ["mochaTest"]);
  const pkg = grunt.file.readJSON("package.json");
  return grunt.initConfig({
    pkg,

    copy: {
      build: {
        cwd: "src",
        src: ["**/*.js"],
        dest: "lib",
        expand: true
      }
    },

    clean: {
      build: {
        src: ["lib", "dist"]
      }
    },

    browserify: {
      dist: {
        files: {
          "dist/JSCPP.js": ["lib/**/*.js"]
        }
      }
    },

    uglify: {
      dist: {
        files: {
          "dist/JSCPP.es5.min.js": ["dist/JSCPP.es5.js"]
        }
      }
    },

    babel: {
      options: {
        sourceMap: true,
        presets: ['@babel/preset-env']
      },
      dist: {
        files: {
          'dist/JSCPP.es5.js': 'dist/JSCPP.js'
        }
      }
    },

    concat: {
      options: {
        separator: ";"
      },
      dist: {
        src: ["node_modules/traceur/bin/traceur-runtime.js", "dist/JSCPP.es5.js"],
        dest: "dist/JSCPP.es5.js"
      }
    },

    peg: {
      build: {
        cwd: "pegjs",
        src: ["**/*.pegjs"],
        dest: "src",
        ext: ".js",
        expand: true
      }
    },

    ts: {
      default: {
        src: ["src/**/*.ts"],
        outDir: "lib/",
        options: {
          rootDir: "src",
          additionalFlags: "--downlevelIteration"
        }
      }
    },

    watch: {
      peg: {
        files: "pegjs/**/*.pegjs",
        tasks: ["newer:peg"]
      },
      copy: {
        files: ["src/**/*.js"],
        tasks: ["newer:copy"]
      }
    }
  });
};
<|endoftext|>


<commit_before>/*eslint-disable no-process-env */
module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    eslint: {
      options: {
      },
      files: [
        '*.js',
        'bench/**/*.js',
        'tasks/**/*.js',
        'lib/**/!(*.min|parser).js',
        'spec/**/!(*.amd|json2|require).js'
      ]
    },

    clean: ['tmp', 'dist', 'lib/handlebars/compiler/parser.js'],

    copy: {
      dist: {
        options: {
          processContent: function(content) {
            return grunt.template.process('/*!\n\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n@license\n*/\n')
                + content;
          }
        },
        files: [
          {expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/'}
        ]
      },
      cdnjs: {
        files: [
          {expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/cdnjs'}
        ]
      },
      components: {
        files: [
          {expand: true, cwd: 'components/', src: ['**'], dest: 'dist/components'},
          {expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/components'}
        ]
      }
    },

    babel: {
      options: {
        loose: ['es6.modules'],
        auxiliaryCommentBefore: 'istanbul ignore next'
      },
      amd: {
        options: {
          modules: 'amd'
        },
        files: [{
          expand: true,
          cwd: 'lib/',
          src: '**/!(index).js',
          dest: 'dist/amd/'
        }]
      },

      cjs: {
        options: {
          modules: 'common'
        },
        files: [{
          cwd: 'lib/',
          expand: true,
          src: '**/!(index).js',
          dest: 'dist/cjs/'
        }]
      }
    },
    webpack: {
      options: {
        context: __dirname,
        module: {
          loaders: [
            // the optional 'runtime' transformer tells babel to require the runtime instead of inlining it.
            { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?optional=runtime&loose=es6.modules&auxiliaryCommentBefore=istanbul%20ignore%20next' }
          ]
        },
        output: {
          path: 'dist/',
          library: 'Handlebars',
          libraryTarget: 'umd'
        }
      },
      handlebars: {
        entry: './lib/handlebars.js',
        output: {
          filename: 'handlebars.js'
        }
      },
      runtime: {
        entry: './lib/handlebars.runtime.js',
        output: {
          filename: 'handlebars.runtime.js'
        }
      }
    },

    requirejs: {
      options: {
        optimize: 'none',
        baseUrl: 'dist/amd/'
      },
      dist: {
        options: {
          name: 'handlebars',
          out: 'dist/handlebars.amd.js'
        }
      },
      runtime: {
        options: {
          name: 'handlebars.runtime',
          out: 'dist/handlebars.runtime.amd.js'
        }
      }
    },

    uglify: {
      options: {
        mangle: true,
        compress: true,
        preserveComments: 'some'
      },
      dist: {
        files: [{
          cwd: 'dist/',
          expand: true,
          src: ['handlebars*.js', '!*.min.js'],
          dest: 'dist/',
          rename: function(dest, src) {
            return dest + src.replace(/\.js$/, '.min.js');
          }
        }]
      }
    },

    concat: {
      tests: {
        src: ['spec/!(require).js'],
        dest: 'tmp/tests.js'
      }
    },

    connect: {
      server: {
        options: {
          base: '.',
          hostname: '*',
          port: 9999
        }
      }
    },
    'saucelabs-mocha': {
      all: {
        options: {
          build: process.env.TRAVIS_JOB_ID,
          urls: ['http://localhost:9999/spec/?headless=true', 'http://localhost:9999/spec/amd.html?headless=true'],
          detailedError: true,
          concurrency: 2,
          browsers: [
            {browserName: 'chrome'},
            {browserName: 'firefox'},
            {browserName: 'safari', version: 7, platform: 'OS X 10.9'},
            {browserName: 'safari', version: 6, platform: 'OS X 10.8'},
            {browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'},
            {browserName: 'internet explorer', version: 10, platform: 'Windows 8'},
            {browserName: 'internet explorer', version: 9, platform: 'Windows 7'}
          ]
        }
      },
      sanity: {
        options: {
          build: process.env.TRAVIS_JOB_ID,
          urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/amd-runtime.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
          detailedError: true,
          concurrency: 2,
          browsers: [
            {browserName: 'chrome'}
          ]
        }
      }
    },

    watch: {
      scripts: {
        options: {
          atBegin: true
        },

        files: ['src/*', 'lib/**/*.js', 'spec/**/*.js'],
        tasks: ['build', 'amd', 'tests', 'test']
      }
    }
  });

  // Build a new version of the library
  this.registerTask('build', 'Builds a distributable version of the current project', [
                    'eslint',
                    'parser',
                    'node',
                    'globals']);

  this.registerTask('amd', ['babel:amd', 'requirejs']);
  this.registerTask('node', ['babel:cjs']);
  this.registerTask('globals', ['webpack']);
  this.registerTask('tests', ['concat:tests']);

  this.registerTask('release', 'Build final packages', ['eslint', 'amd', 'uglify', 'copy:dist', 'copy:components', 'copy:cdnjs']);

  // Load tasks from npm
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-babel');
  grunt.loadNpmTasks('grunt-eslint');
  grunt.loadNpmTasks('grunt-saucelabs');
  grunt.loadNpmTasks('grunt-webpack');

  grunt.task.loadTasks('tasks');

  grunt.registerTask('bench', ['metrics']);
  grunt.registerTask('sauce', process.env.SAUCE_USERNAME ? ['tests', 'connect', 'saucelabs-mocha'] : []);

  grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'sauce', 'metrics', 'publish:latest'] : ['default']);

  grunt.registerTask('dev', ['clean', 'connect', 'watch']);
  grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
};
<commit_msg>Specify platform for firefox in sauce tests<commit_after>/*eslint-disable no-process-env */
module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    eslint: {
      options: {
      },
      files: [
        '*.js',
        'bench/**/*.js',
        'tasks/**/*.js',
        'lib/**/!(*.min|parser).js',
        'spec/**/!(*.amd|json2|require).js'
      ]
    },

    clean: ['tmp', 'dist', 'lib/handlebars/compiler/parser.js'],

    copy: {
      dist: {
        options: {
          processContent: function(content) {
            return grunt.template.process('/*!\n\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n@license\n*/\n')
                + content;
          }
        },
        files: [
          {expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/'}
        ]
      },
      cdnjs: {
        files: [
          {expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/cdnjs'}
        ]
      },
      components: {
        files: [
          {expand: true, cwd: 'components/', src: ['**'], dest: 'dist/components'},
          {expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/components'}
        ]
      }
    },

    babel: {
      options: {
        loose: ['es6.modules'],
        auxiliaryCommentBefore: 'istanbul ignore next'
      },
      amd: {
        options: {
          modules: 'amd'
        },
        files: [{
          expand: true,
          cwd: 'lib/',
          src: '**/!(index).js',
          dest: 'dist/amd/'
        }]
      },

      cjs: {
        options: {
          modules: 'common'
        },
        files: [{
          cwd: 'lib/',
          expand: true,
          src: '**/!(index).js',
          dest: 'dist/cjs/'
        }]
      }
    },
    webpack: {
      options: {
        context: __dirname,
        module: {
          loaders: [
            // the optional 'runtime' transformer tells babel to require the runtime instead of inlining it.
            { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?optional=runtime&loose=es6.modules&auxiliaryCommentBefore=istanbul%20ignore%20next' }
          ]
        },
        output: {
          path: 'dist/',
          library: 'Handlebars',
          libraryTarget: 'umd'
        }
      },
      handlebars: {
        entry: './lib/handlebars.js',
        output: {
          filename: 'handlebars.js'
        }
      },
      runtime: {
        entry: './lib/handlebars.runtime.js',
        output: {
          filename: 'handlebars.runtime.js'
        }
      }
    },

    requirejs: {
      options: {
        optimize: 'none',
        baseUrl: 'dist/amd/'
      },
      dist: {
        options: {
          name: 'handlebars',
          out: 'dist/handlebars.amd.js'
        }
      },
      runtime: {
        options: {
          name: 'handlebars.runtime',
          out: 'dist/handlebars.runtime.amd.js'
        }
      }
    },

    uglify: {
      options: {
        mangle: true,
        compress: true,
        preserveComments: 'some'
      },
      dist: {
        files: [{
          cwd: 'dist/',
          expand: true,
          src: ['handlebars*.js', '!*.min.js'],
          dest: 'dist/',
          rename: function(dest, src) {
            return dest + src.replace(/\.js$/, '.min.js');
          }
        }]
      }
    },

    concat: {
      tests: {
        src: ['spec/!(require).js'],
        dest: 'tmp/tests.js'
      }
    },

    connect: {
      server: {
        options: {
          base: '.',
          hostname: '*',
          port: 9999
        }
      }
    },
    'saucelabs-mocha': {
      all: {
        options: {
          build: process.env.TRAVIS_JOB_ID,
          urls: ['http://localhost:9999/spec/?headless=true', 'http://localhost:9999/spec/amd.html?headless=true'],
          detailedError: true,
          concurrency: 2,
          browsers: [
            {browserName: 'chrome'},
            {browserName: 'firefox', platform: 'Linux'},
            {browserName: 'safari', version: 7, platform: 'OS X 10.9'},
            {browserName: 'safari', version: 6, platform: 'OS X 10.8'},
            {browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'},
            {browserName: 'internet explorer', version: 10, platform: 'Windows 8'},
            {browserName: 'internet explorer', version: 9, platform: 'Windows 7'}
          ]
        }
      },
      sanity: {
        options: {
          build: process.env.TRAVIS_JOB_ID,
          urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/amd-runtime.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
          detailedError: true,
          concurrency: 2,
          browsers: [
            {browserName: 'chrome'}
          ]
        }
      }
    },

    watch: {
      scripts: {
        options: {
          atBegin: true
        },

        files: ['src/*', 'lib/**/*.js', 'spec/**/*.js'],
        tasks: ['build', 'amd', 'tests', 'test']
      }
    }
  });

  // Build a new version of the library
  this.registerTask('build', 'Builds a distributable version of the current project', [
                    'eslint',
                    'parser',
                    'node',
                    'globals']);

  this.registerTask('amd', ['babel:amd', 'requirejs']);
  this.registerTask('node', ['babel:cjs']);
  this.registerTask('globals', ['webpack']);
  this.registerTask('tests', ['concat:tests']);

  this.registerTask('release', 'Build final packages', ['eslint', 'amd', 'uglify', 'copy:dist', 'copy:components', 'copy:cdnjs']);

  // Load tasks from npm
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-babel');
  grunt.loadNpmTasks('grunt-eslint');
  grunt.loadNpmTasks('grunt-saucelabs');
  grunt.loadNpmTasks('grunt-webpack');

  grunt.task.loadTasks('tasks');

  grunt.registerTask('bench', ['metrics']);
  grunt.registerTask('sauce', process.env.SAUCE_USERNAME ? ['tests', 'connect', 'saucelabs-mocha'] : []);

  grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'sauce', 'metrics', 'publish:latest'] : ['default']);

  grunt.registerTask('dev', ['clean', 'connect', 'watch']);
  grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
};
<|endoftext|>


<commit_before>#!/usr/bin/env node
var $ = require('./jash');
var repl = require('repl');
global.$ = $;

repl.start({ useGlobal: true, prompt: '> ' });

<commit_msg>adding startup message for the shell<commit_after>#!/usr/bin/env node
var $ = require('./jash');
var repl = require('repl');
global.$ = $;

console.log('jash.js shell.  $.command...');
repl.start({ useGlobal: true, prompt: '> ' });

<|endoftext|>


<commit_before>// Gulp
var gulp = require('gulp');

// Plugins
var gutil = require('gulp-util');
var jade = require('gulp-jade');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var prefix = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var nodemon = require('gulp-nodemon');
var path = require('path');
var tinylr = require('tiny-lr');
var WritableStream = require('stream').Writable;
var svgSprites = require('gulp-svg-sprites');
var svg = svgSprites.svg;
var png = svgSprites.png;

var outputDir = 'dist';
var serverPort = '3000';
var watching = false;

// Paths
var paths = {
  scripts: ['assets/js/*.js'],
  images: ['assets/img/**'],
  icons: ['assets/icons/*.svg']
};

var devnull = function () {
  var stream = new WritableStream({
    objectMode: true
  });
  stream._write = function (chunk, encoding, callback) {
    callback();
  };
  return stream;
};

var liveReloadifWatching = function () {
  if (watching) {
    return livereload();
  } else {
    return devnull();
  }
};

// Compile Jade to HTML
gulp.task('jade', function () {
  gulp.src(['views/**/*.jade', '!./{node_modules/**, node_modules}'])
    .pipe(plumber())
    .pipe(jade({
      pretty: true
    }))
    .pipe(gulp.dest(outputDir))
    .pipe(liveReloadifWatching());
});

// Compile Sass
gulp.task('sass', function () {
  gulp.src(['assets/scss/*.scss', '!assets/scss/_variables.scss'])
    .pipe(plumber())
    .pipe(sass({
      sourceComments: 'map'
    }))
    .pipe(prefix(
      "last 1 version", "> 1%", "ie 8", "ie 7"
    ))
    .pipe(gulp.dest(outputDir + '/assets/css'))
    .pipe(minifycss())
    .pipe(gulp.dest(outputDir + '/assets/css'))
    .pipe(liveReloadifWatching());
});

// Uglify JS
gulp.task('uglify', function () {
  gulp.src(paths.scripts)
    .pipe(plumber())
    .pipe(uglify({
      outSourceMap: false
    }))
    .pipe(gulp.dest(outputDir + '/assets/js'))
    .pipe(liveReloadifWatching());
});

// Copy images.
gulp.task('copyimages', function () {
  gulp.src(paths.images)
    .pipe(gulp.dest(outputDir + '/assets/img'));
});

gulp.task('sprites', function () {
  gulp.src(paths.icons)
    .pipe(svg({
      className: ".%f-icon",
      cssFile: "../../assets/sprites/_sprites.scss",
      preview: {
        svgSprite: "sprites/preview-svg-sprite.html"
      }
    }))
    .pipe(gulp.dest(outputDir + '/assets'))
});

// Watch files
gulp.task('watch', function (event) {
  gulp.watch('views/**/*.jade', ['jade']);
  gulp.watch('assets/scss/*.scss', ['sass']);
  gulp.watch(paths.images, ['copyimages']);
  gulp.watch(paths.icons, ['sprites']);
  gulp.watch(paths.scripts, ['uglify']);

  watching = true;
});

gulp.task('server', function () {
  nodemon({
    script: 'server.js'
  })
    .on('restart', function () {
      console.log('restarted node');
    });
});

gulp.task('build', ['jade', 'sprites', 'sass', 'uglify', 'copyimages']);
gulp.task('default', ['build', 'watch', 'server']);<commit_msg>Do we need this dot?<commit_after>// Gulp
var gulp = require('gulp');

// Plugins
var gutil = require('gulp-util');
var jade = require('gulp-jade');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var prefix = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var nodemon = require('gulp-nodemon');
var path = require('path');
var tinylr = require('tiny-lr');
var WritableStream = require('stream').Writable;
var svgSprites = require('gulp-svg-sprites');
var svg = svgSprites.svg;
var png = svgSprites.png;

var outputDir = 'dist';
var serverPort = '3000';
var watching = false;

// Paths
var paths = {
  scripts: ['assets/js/*.js'],
  images: ['assets/img/**'],
  icons: ['assets/icons/*.svg']
};

var devnull = function () {
  var stream = new WritableStream({
    objectMode: true
  });
  stream._write = function (chunk, encoding, callback) {
    callback();
  };
  return stream;
};

var liveReloadifWatching = function () {
  if (watching) {
    return livereload();
  } else {
    return devnull();
  }
};

// Compile Jade to HTML
gulp.task('jade', function () {
  gulp.src(['views/**/*.jade', '!./{node_modules/**, node_modules}'])
    .pipe(plumber())
    .pipe(jade({
      pretty: true
    }))
    .pipe(gulp.dest(outputDir))
    .pipe(liveReloadifWatching());
});

// Compile Sass
gulp.task('sass', function () {
  gulp.src(['assets/scss/*.scss', '!assets/scss/_variables.scss'])
    .pipe(plumber())
    .pipe(sass({
      sourceComments: 'map'
    }))
    .pipe(prefix(
      "last 1 version", "> 1%", "ie 8", "ie 7"
    ))
    .pipe(gulp.dest(outputDir + '/assets/css'))
    .pipe(minifycss())
    .pipe(gulp.dest(outputDir + '/assets/css'))
    .pipe(liveReloadifWatching());
});

// Uglify JS
gulp.task('uglify', function () {
  gulp.src(paths.scripts)
    .pipe(plumber())
    .pipe(uglify({
      outSourceMap: false
    }))
    .pipe(gulp.dest(outputDir + '/assets/js'))
    .pipe(liveReloadifWatching());
});

// Copy images.
gulp.task('copyimages', function () {
  gulp.src(paths.images)
    .pipe(gulp.dest(outputDir + '/assets/img'));
});

gulp.task('sprites', function () {
  gulp.src(paths.icons)
    .pipe(svg({
      className: "%f-icon",
      cssFile: "../../assets/sprites/_sprites.scss",
      preview: {
        svgSprite: "sprites/preview-svg-sprite.html"
      }
    }))
    .pipe(gulp.dest(outputDir + '/assets'))
});

// Watch files
gulp.task('watch', function (event) {
  gulp.watch('views/**/*.jade', ['jade']);
  gulp.watch('assets/scss/*.scss', ['sass']);
  gulp.watch(paths.images, ['copyimages']);
  gulp.watch(paths.icons, ['sprites']);
  gulp.watch(paths.scripts, ['uglify']);

  watching = true;
});

gulp.task('server', function () {
  nodemon({
    script: 'server.js'
  })
    .on('restart', function () {
      console.log('restarted node');
    });
});

gulp.task('build', ['jade', 'sprites', 'sass', 'uglify', 'copyimages']);
gulp.task('default', ['build', 'watch', 'server']);<|endoftext|>


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

	require('load-grunt-tasks')(grunt);
	require('time-grunt')(grunt);

	grunt.initConfig({
		sass: {
			task: {
				files: [{
					expand: true,
					cwd: 'styles',
					src: [
						'screen.scss',
						'search.scss'
					],
					dest: 'styles',
					ext: '.css'
				}]
			}
		},
		cssmin: {
			task: {
				files: [{
					expand: true,
					cwd: 'styles',
					src: '*.css',
					dest: 'styles'
				}]
			}
		},
		autoprefixer: {
			task: {
				src: 'styles/*.css'
			}
		},
		jekyll: {
			full: {
				//
			},
			limit: {
				options: {
					limit_posts: 150
				}
			}
		},
		htmlmin: {
			html: {
				options: {
					removeComments: true,
					collapseWhitespace: true
				},
				expand: true,
				cwd: '_site/',
				src: [
					'**/index.html',
					'errors/*.html'
				],
				dest: '_site/'
			},
			xml: {
				options: {
					collapseWhitespace: true,
					keepClosingSlash: true
				},
				expand: true,
				cwd: '_site/feed/',
				src: '**/index.xml',
				dest: '_site/feed/'
			}
		},
		connect: {
			task: {
				options: {
					base: '_site',
					port: 33310,
					livereload: true,
					open: true
				}
			}
		},
		watch: {
			styles: {
				files: 'styles/*.scss',
				tasks: [
					'styles',
					'copy'
				]
			},
			limit: {
				files: [
					'**',

					'!.git/**',
					'!.sass-cache/**',

					'!_scripts/**',
					'!_site/**',

					'!CONTRIBUTING.md',
					'!LICENSE.md',
					'!README.md',

					'!Gruntfile.js',
					'!node_modules/**',
					'!package.json',
					'!install.sh',
					'!styles/*',

					'!{articles,blog,tv}/**',
						'{articles,blog,tv}/index.html',
						'{articles,blog,tv}/**/_posts/*.md'
				],
				tasks: [
					'jekyll:limit',
					'htmlmin'
				]
			},
			livereload: {
				options: {
					livereload: true
				},
				files: [
					'_site/**/*.html',
					'_site/styles/screen.css'
				]
			}
		},
		copy: {
			task: {
				files: [{
					src: 'styles/*.css',
					dest: '_site/'
				}]
			}
		},
		replace: {
			task: {
				src: '.htaccess',
				dest: '_site/',
				replacements: [{
					// Redirect all traffic to https://dev.opera.com/*
					from: 'RewriteEngine On\n\n',
					to: 'RewriteEngine On\n\nRewriteCond %{HTTP_HOST} !^dev\\.opera\\.com [NC]\nRewriteRule ^(.*)$ https://dev.opera.com%{REQUEST_URI} [R=301,L]\n\nRewriteCond %{HTTPS} off\nRewriteRule ^(.*)$ https://dev.opera.com%{REQUEST_URI} [R=301,L]\n\n'
				}]
			}
		},
		rsync: {
			options: {
				args: [
					'--checksum', // skip based on checksum, not mod-time & size
					'--chmod=ug=rwX,o=rX', // `chmod` new files
					'--compress', // compress data during the transfer
					// Note: the next line is commented out to avoid deleting the
					// `extension-docs` directory, which is generated from a separate
					// repository at the moment. As soon as the extension docs are merged
					// with the main `devopera` repository, we should re-enable it.
					//'--delete', // delete extraneous files on the receiving side
					'--human-readable', // output numbers in a human-readable format
					'--itemize-changes', // output a change-summary for all updates
					'--omit-dir-times', // …except for directories
					'--progress', // show progress during transfer
					'--stats', // show some file-transfer stats
					'--times', // preserve modification times…
					'--verbose' // increase verbosity
				],
				exclude: ['.DS_Store'],
				recursive: true
			},
			deploy: {
				options: {
					src: '_site/',
					dest: '/var/www/html/',
					host: '54.213.240.91'
				}
			}
		}
	});

	grunt.registerTask('styles', [
		'sass',
		'autoprefixer',
		'cssmin'
	]);

	grunt.registerTask('default', [
		'styles',
		'jekyll:limit',
		'htmlmin',
		'connect',
		'watch'
	]);

	grunt.registerTask('build', [
		'styles',
		'jekyll:full',
		'htmlmin',
		'connect:task:keepalive'
	]);

	grunt.registerTask('deploy', [
		'replace',
		'rsync'
	]);

};
<commit_msg>Proper watcher<commit_after>module.exports = function(grunt) {

	require('load-grunt-tasks')(grunt);
	require('time-grunt')(grunt);

	grunt.initConfig({
		sass: {
			task: {
				files: [{
					expand: true,
					cwd: 'styles',
					src: [
						'screen.scss',
						'search.scss'
					],
					dest: 'styles',
					ext: '.css'
				}]
			}
		},
		cssmin: {
			task: {
				files: [{
					expand: true,
					cwd: 'styles',
					src: '*.css',
					dest: 'styles'
				}]
			}
		},
		autoprefixer: {
			task: {
				src: 'styles/*.css'
			}
		},
		jekyll: {
			full: {
				//
			},
			limit: {
				options: {
					limit_posts: 150
				}
			}
		},
		htmlmin: {
			html: {
				options: {
					removeComments: true,
					collapseWhitespace: true
				},
				expand: true,
				cwd: '_site/',
				src: [
					'**/index.html',
					'errors/*.html'
				],
				dest: '_site/'
			},
			xml: {
				options: {
					collapseWhitespace: true,
					keepClosingSlash: true
				},
				expand: true,
				cwd: '_site/feed/',
				src: '**/index.xml',
				dest: '_site/feed/'
			}
		},
		connect: {
			task: {
				options: {
					base: '_site',
					port: 33310,
					livereload: true,
					open: true
				}
			}
		},
		watch: {
			styles: {
				files: 'styles/*.scss',
				tasks: [
					'styles',
					'copy'
				]
			},
			limit: {
				files: [
					'**',

					'!.git/**',
					'!.sass-cache/**',

					'!_scripts/**',
					'!_site/**',

					'!CONTRIBUTING.md',
					'!LICENSE.md',
					'!README.md',

					'!Gruntfile.js',
					'!node_modules/**',
					'!package.json',
					'!install.sh',
					'!styles/*',

					'!{articles,blog,tv}/**',
						'{articles,blog,tv}/index.html',
						'{articles,blog,tv}/**/_posts/*.md'
				],
				tasks: [
					'jekyll:limit',
					'htmlmin'
				]
			},
			livereload: {
				options: {
					livereload: true
				},
				files: [
					'_site/**/*.html',
					'_site/styles/*.css'
				]
			}
		},
		copy: {
			task: {
				files: [{
					expand: true,
					src: 'styles/*.css',
					dest: '_site/'
				}]
			}
		},
		replace: {
			task: {
				src: '.htaccess',
				dest: '_site/',
				replacements: [{
					// Redirect all traffic to https://dev.opera.com/*
					from: 'RewriteEngine On\n\n',
					to: 'RewriteEngine On\n\nRewriteCond %{HTTP_HOST} !^dev\\.opera\\.com [NC]\nRewriteRule ^(.*)$ https://dev.opera.com%{REQUEST_URI} [R=301,L]\n\nRewriteCond %{HTTPS} off\nRewriteRule ^(.*)$ https://dev.opera.com%{REQUEST_URI} [R=301,L]\n\n'
				}]
			}
		},
		rsync: {
			options: {
				args: [
					'--checksum', // skip based on checksum, not mod-time & size
					'--chmod=ug=rwX,o=rX', // `chmod` new files
					'--compress', // compress data during the transfer
					// Note: the next line is commented out to avoid deleting the
					// `extension-docs` directory, which is generated from a separate
					// repository at the moment. As soon as the extension docs are merged
					// with the main `devopera` repository, we should re-enable it.
					//'--delete', // delete extraneous files on the receiving side
					'--human-readable', // output numbers in a human-readable format
					'--itemize-changes', // output a change-summary for all updates
					'--omit-dir-times', // …except for directories
					'--progress', // show progress during transfer
					'--stats', // show some file-transfer stats
					'--times', // preserve modification times…
					'--verbose' // increase verbosity
				],
				exclude: ['.DS_Store'],
				recursive: true
			},
			deploy: {
				options: {
					src: '_site/',
					dest: '/var/www/html/',
					host: '54.213.240.91'
				}
			}
		}
	});

	grunt.registerTask('styles', [
		'sass',
		'autoprefixer',
		'cssmin'
	]);

	grunt.registerTask('default', [
		'styles',
		'jekyll:limit',
		'htmlmin',
		'connect',
		'watch'
	]);

	grunt.registerTask('build', [
		'styles',
		'jekyll:full',
		'htmlmin',
		'connect:task:keepalive'
	]);

	grunt.registerTask('deploy', [
		'replace',
		'rsync'
	]);

};
<|endoftext|>