﻿var notifier = require('node-notifier');
var argv = require('yargs').argv;

module.exports = (function () {
    var projectName = "novicell-gulp";

    var projectPath = "./";
    var bowerPath = projectPath + "vendor/bower";
    var distPath = projectPath + "dist";

    var cleanPaths = [distPath];

    var debug = true;

    return {
        debug: (argv.debug !== undefined ? argv.debug.toLowerCase() == "true" : debug),

        errorHandler: function(taskName)
        {
            return function (e) {
                notifier.notify({
                    "title": taskName,
                    "message": "An error occured in the " + e.plugin + " plugin."
                });
                console.log(e.message);
                this.emit("end");
            };
        },

        bowerPath: bowerPath,
        cleanPaths: cleanPaths,

        loadTasks: [
            "bower", "styles", "scripts",
            "images", "icons", "copy",
            "watch", "build"
        ],
        buildTasks: [
            "bower", "styles", "scripts",
            "images", "icons", "copy"
        ],

        // ------------- Scripts -------------
        scriptsDist: distPath + "/scripts",

        // ------------- Icons ---------------
        iconsDist: distPath,
        spriteConfig: {
            shape : {
                // Set maximum dimensions
                dimension       : {
                    maxWidth    : 32,
                    maxHeight   : 32
                }
            },
            mode : {
                view : {
                    bust : false,
                    render : {
                        less : true
                    },
                    dest : 'icons',
                    sprite : 'icons-css.svg'
                },
                symbol : {
                    dest : 'icons',
                    sprite : 'icons.svg'
                }
            }
        },

        // ------------- Fonts -------------
        fontsDist: distPath + "/fonts",

        // ------------- Styles -------------
        stylesDist: distPath + "/css",
        stylesVendorPrefixes: [
            "last 2 version",
            "safari 5",
            "ie 8",
            "ie 9",
            "opera 12.1",
            "ios 6",
            "android 4"
        ],

        // ------------- Images -------------
        imagesDist: distPath + "/images",
        imagesOptimizationLevel: 5,
        imagesProgressive: true,
        imagesInterlaced: true,

        // ------------- Livereload -------------
        livereloadPort: 35729,
        livereloadPaths: [
            "./dist/scripts/*.js",
            "./dist/css/*.css",
            "./macroScripts/*.{cshtml,master,xslt,php,phtml,html}",
            "./MasterPages/*.{cshtml,master,xslt,php,phtml,html}"
        ],

        // ------------- Watch -------------
        watchImages: ["./images/*"],
        watchIcons: ["./images/icons/*"],
        watchFonts: ["./fonts/*"],
        watchScripts: [
            "./scripts/**/*.js",
            "./vendor/**/*.js"
        ],
        watchStyles: [
            "./less/**/*.less",
            "./vendor/**/*.less"
        ],

        // ------------- Copy on build -------------
        buildCopy: [{
            from: "./fonts/**/*",
            to: distPath  + "/fonts"
        }],

        // ------------- Bundles -------------
        bundles: [{
            name: "vendor",
            ignorePlugins: ["jscs", "jshint"],
            scripts: ["./vendor/bower/jquery/dist/jquery.js" ]
        },
        {
            name: "master",
            scripts: ["./scripts/master.js"],
            styles: ["./less/master.less"],
            images: ["./images/*.{jpg,png}"],
            icons: ["./images/icons/*.svg"],
            tpl: [ "./tpl/*.tpl.html" ]
        }]
    }
})();
@@ -2660,24 +2660,56 @@
 css/*.css%22,%0A
+            %22./Views/*.cshtml%22,%0A
             
@@ -2730,43 +2730,14 @@
 s/*.
-%7B
 cshtml
-,master,xslt,php,phtml,html%7D
 %22,%0A 
@@ -2768,43 +2768,14 @@
 s/*.
-%7Bcshtml,master,xslt,php,phtml,html%7D
+master
 %22%0A  
@@ -2855,20 +2855,70 @@
 s: %5B
-%22./images/*%22
+ projectPath + %22images/**/*%22, projectPath + '!images/icons/*' 
 %5D,%0A 
@@ -2933,27 +2933,40 @@
 atchIcons: %5B
-%22./
+ projectPath + %22
 images/icons
@@ -2964,24 +2964,25 @@
 ges/icons/*%22
+ 
 %5D,%0A        w
@@ -2997,19 +2997,32 @@
 s: %5B
-%22./
+ projectPath + %22
 fonts/*%22
 %5D,%0A 
@@ -3017,16 +3017,17 @@
 fonts/*%22
+ 
 %5D,%0A     
@@ -3057,19 +3057,31 @@
         
-%22./
+projectPath + %22
 scripts/
@@ -3094,35 +3094,47 @@
 s%22,%0A            
-%22./
+projectPath + %22
 vendor/**/*.js%22%0A
@@ -3179,19 +3179,31 @@
         
-%22./
+projectPath + %22
 less/**/
@@ -3223,19 +3223,31 @@
         
-%22./
+projectPath + %22
 vendor/*
@@ -3361,19 +3361,31 @@
   from: 
-%22./
+projectPath + %22
 fonts/**
@@ -3607,23 +3607,22 @@
 s: %5B
-%22./vendor/bower
+ bowerPath + %22
 /jqu

fix paths in config file