Example #1
0
    gulp.watch('gebo_src/sass/**/*.scss', function (event) {
        var paths = watchPath(event,'gebo_src/sass/','gebo_src/css/');

        gutil.log(gutil.colors.green(event.type) + ' ' + paths.srcPath);
        gutil.log('Dist ' + paths.distPath);

        gulp.src(paths.srcPath)
        return sass(cssSrc, {style: 'expanded'})
            .pipe(gulp.dest(cssSrca))
            .pipe(rename({suffix: '.min' }))
            .pipe(cssnano())//精简
            .pipe(gulp.dest(cssSrca))
            .on('error', function (err) {
                console.error('Error!', err.message);
            });

    })
Example #2
0
    gulp.watch('src/sass/**/*', function (event) {
        var paths = watchPath(event, 'src/sass/', 'dist/css/')

        gutil.log(gutil.colors.green(event.type) + ' ' + paths.srcPath)
        gutil.log('Dist ' + paths.distPath)
        sass(paths.srcPath)
            .on('error', function (err) {
                console.error('Error!', err.message);
            })
            .pipe(sourcemaps.init())
            .pipe(minifycss())
            .pipe(autoprefixer({
                browsers: 'last 2 versions'
            }))
            .pipe(sourcemaps.write('./'))
            .pipe(gulp.dest(paths.distDir))
    })
Example #3
0
function getScss () {
  return sass('src/styles/main.scss', {
      style: 'compressed',
      loadPath: [
        'src/styles/modules',
        'src/styles/partials',
        'src/styles/vendor',
        'node_modules/bootstrap-sass/assets/stylesheets',
        'node_modules/font-awesome/scss'
      ]
    })
      .on("error", notify.onError(function (error) {
        return "Error: " + error.message;
      }))
    .pipe(rev())
    .pipe(gulp.dest('dist/css'));
}
Example #4
0
gulp.task('sass', function() {
    var cssSrc = './src/sass/*.scss',
        cssSrca= './src/css';//源码也输出一份


    gulp.src(cssSrc)
    // .pipe(sass({ style: 'expanded'}))
    return sass(cssSrc, {style: 'expanded'})
        .pipe(gulp.dest(cssSrca))
        .pipe(rename({suffix: '.min' }))
        .pipe(cssnano())//精简
        .pipe(gulp.dest(cssSrca))
        .on('error', function (err) {
            console.error('Error!', err.message);
        });

});
gulp.task('sass', function() {

    return gulp.src('./src/scss/main.scss')
        .pipe(inject(gulp.src(["./src/app/**/*.scss"], {
            read: false
        }), {
            transform: function(filepath) {
                return "@import '../.." + filepath + "';"
            },
            starttag: "/* inject:scss */",
            endtag: "/* endinject */"
        }))
        .pipe(sass())
        .pipe(rename('app.css'))
        .pipe(gulp.dest(env.destFolder));

});
Example #6
0
 gulp.task('styles', () => {
   return gulp.src('app/styles/*.scss')
     .pipe(sourcemaps.init())
     .pipe(sass({
       style: 'expanded',
       precision: 10,
       sourcemap: (!optimize),
       sourcemapPath: '.',
       loadPath: ['bower_components/bourbon/dist', 'bower_components/compass-mixins/lib']
     }))
     .on('error', ErrorHandler.onError)
     .pipe(autoprefixer(cfg.autoprefixer))
     .pipe(sourcemaps.write('.'))
     .pipe(gulp.dest('.tmp/styles'))
     .pipe(filter('**/*.css'))
     .pipe(reload({stream: true}));
 });
Example #7
0
gulp.task('styles', function() {
	return gulp.src(options.publicPath+options.styleDir+'/global.scss')
		.pipe(sass({ style: 'expanded' }))
		.on('error', notify.onError(function (error) {
				// remove all Before the sass Dir
				var msg = error.message.substr( error.message.indexOf(options.styleDir) , 200); //200 is faster then error.message.length - indexOf bla bla bla.
	            return "Error: " + msg;
            }))
		.on('error', swallowError)
		// .pipe(styles({errorHandler: notify.onError("Error: <%= error.message %>")}))
		.pipe(autoprefixer('last 2 version', 'safari 5', 'opera 12.1'))
		.pipe(gulp.dest(options.publicPath+'css'))
		.pipe(rename({suffix: '.min'}))
		.pipe(minifycss())
		.pipe(gulp.dest(options.publicPath+'css'))
		.pipe(notify("The CSS is Gulpisize ;) !"));
});
Example #8
0
gulp.task('styles', function() {

    var sass = require('gulp-ruby-sass')
    var autoprefixer = require('gulp-autoprefixer')
    var cssImport = require('gulp-cssimport')
    var minifycss = require('gulp-minify-css')
    return sass('assets/css/base.scss', {
        'sourcemap=none': true,
        precision: 10,
        style: 'expanded',
    })
        .pipe(cssImport())
        .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
        .pipe(_if(args.production, minifycss()))
        .pipe(rename('app.css'))
        .pipe(gulp.dest('./build/css'))
})
Example #9
0
	gulp.task('admin', function () {
		return sass(assetsDir + '/sass/admin.scss', {
			sourcemap  : config.sass.sourcemap,
			lineNumbers: config.sass.lineNumbers,
			container  : 'gulp-ruby-sass-admin'
		})
			.on('error', function (err) {
				console.error('Error', err.message);
				notify.forFailedTests(err, 'petrieSass');
			})
			.pipe(sourcemaps.write('./', {
				includeContent: true,
				sourceRoot    : elixirconfig.production ? paths.sass : paths.css
			}))
			.pipe(gulp.dest(paths.css))
			.pipe(notify.message('Stylesheet \'admin.scss\' has been compiled.'));
	});
Example #10
0
 gulp.task('styles', () => {
   return sass('app', {
     style: 'expanded',
     precision: 10,
     sourcemap: (!optimize),
     loadPath: ['bower_components/bourbon/dist', 'bower_components/compass-mixins/lib']
   })
   .on('error', ErrorHandler.onError)
   .pipe(autoprefixer(cfg.autoprefixer))
   .pipe(sourcemaps.write('.', {
     includeContent: false,
     sourceRoot: '.'
   }))
   .pipe(gulp.dest('.tmp'))
   .pipe(filter('**/*.css'))
   .pipe(reload({stream: true}));
 });
Example #11
0
gulp.task('sass', function() {
  var style = dev ? 'expanded' : 'compressed';
  return sass('client/scss/', {
          sourcemap: false,
          loadPath: ['bower_components', '.'],
          precision: 5,
          quiet: dev,
          debugInfo: dev,
          style: style
        }).on('error', function (err) { console.log(err.message); if (!dev) throw err; })
        .pipe(autoprefixer({
          browsers: ['> 5%', 'iOS >= 6', 'IE >= 7', 'FF ESR', 'last 2 versions'],
          cascade: dev,
          remove: true
        }))
        .pipe(gulp.dest('./public/css'));
});
gulp.task('minify', function () {
	gulp.src(paths.scripts)
		.pipe(uglify())
		.pipe(concat('frontend.min.js'))
		.pipe(gulp.dest('build/js'));
	gulp.src(paths.scssBase)
		.pipe(sass({style: 'compressed'}))
		.pipe(autoprefix('last 2 version', 'ie 8', 'ie 9'))
		.pipe(gulp.dest('build/css'));
	gulp.src(paths.images)
		.pipe(imagemin({
			progressive: true,
			optimizationLevel: 5,
			svgoPlugins: [{removeViewBox: false, removeUselessStrokeAndFill: false}]
		}))
		.pipe(gulp.dest("build/images"));
});
Example #13
0
gulp.task('styles', function() {
  var processors = [
    require('autoprefixer')({ browsers: ['last 3 version', 'ie 8'], cascade: false })
  ];

  gulp.src(paths.styles)
    .pipe(plumber())
    .pipe(sass())
    .on('error', function(err) {
      console.log(err.message);
    })
    .pipe(minifycss())
    .pipe(filter("**/*.css"))
    .pipe(postcss(processors))
    .pipe(gulp.dest('../public/stylesheets'))
    .pipe(reload({stream:true}));
});
Example #14
0
gulp.task('sass', function() {
        return sass('./src/sass/**/*.scss', {
            sourcemap: true,
            // 嵌套输出方式 nested, 展开输出方式 expanded, 紧凑输出方式 compact, 压缩输出方式 compressed
            style: 'expanded'
        })
        .on('error', sass.logError)
        // 在css文件中写souremaps
        // .pipe(sourcemaps.write())

        // 在.map文件中写sourcemaps
        .pipe(sourcemaps.write('./', {   // map文件的路径, 相对于css文件
            includeContent: false,
            sourceRoot: '../sass'        // scss文件的路径, 相对于map文件
        }))
        .pipe(gulp.dest('./src/css'));
});
Example #15
0
gulp.task('sass', function() {
  return sass('src/scss/*.scss').on('error', sass.logError) //编译sass
    // gulp.src('src/scss/*.scss')
  	// .pipe(sass({sourcemap: true, sourcemapPath: '../scss'}))
  	// 保存未压缩文件到我们指定的目录下面
    .pipe(gulp.dest('dist/css')) 
    //添加前缀
    .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
    //给文件添加.min后缀
    .pipe(rename({suffix: '.min'}))
    //压缩样式文件
    .pipe(minifyCSS())
    //实时更新
    // .pipe(reload({stream: true}));
    //输出压缩文件到指定目录
    .pipe(gulp.dest('dist/css'));
});
gulp.task('CompileScss', function () {
    return gulp.src(['app/styles/**/*.scss'])
        .pipe(sass({
            style: 'expanded',
            loadPath: [
                'app/styles/**/*.scss',
                paths.bootstrap + '/stylesheets',
                paths.fontawesome + '/fontawesome/scss'
            ]
        }))
        .on("error", notify.onError(function (error) {
            return "Error: " + error.message;
        }))
        .pipe(autoprefixer('last 2 version'))
        .pipe(gulp.dest('app/styles'))
        .pipe(notify({ message: 'CompileScss task complete' }));
})
gulp.task('sass', function() {
    return gulp.src(config.sassPath + '/style.scss')
        .pipe(sass({
            style: 'compressed',
            loadPath: [
                './src/sass',
				// /vendor/twbs/bootstrap-sass/assets/stylesheets
                config.vendorDir + '/twbs/bootstrap-sass/assets/stylesheets',
				// /vendor/fortawesome/font-awesome/scss
                config.vendorDir + '/fortawesome/font-awesome/scss',
            ]
        })
            .on("error", notify.onError(function (error) {
                return "Error: " + error.message;
            })))
        .pipe(gulp.dest('./dist/css'));
});
Example #18
0
gulp.task('css', function () {
  return sass(pathMap.cssSrcPath, {style: 'expanded'})
    .pipe(gulp.dest(pathMap.cssDistPath))
    .pipe(rename({suffix: '.min'}))
    .pipe(minifycss())
    .pipe(base64({
      baseDir: '',
      extensions: ['png', 'jpg', 'gif'],
      maxImageSize: 10 * 1024, // bytes
      deleteAfterEncoding: false,
      debug: false
    }))
    .pipe(gulp.dest(pathMap.cssDistPath))
    .on('end', function () {
      console.log('task css finished!');
    });
});
Example #19
0
gulp.task("sass",function(){

    if( !settings.sass ){
        throw "No Settings for tsc";
    }

    var _conf = settings.sass.default;
    //var _filter = new filter(["*","!*.css"]);

    return gulp.src([_conf.srcDir+'/**/*.scss'])
        .pipe(plumber())
        .pipe(sass({

        }))
        .pipe(gulp.dest(_conf.destDir));

});
Example #20
0
gulp.task('sass', function() {
  var stream = gulp.src(styles_input + '/*.sass')
      .pipe(plumber({
        errorHandler: onError
      }))
      .pipe(sass({
        style: 'expanded'
      }))
      .pipe(autoprefixer(
        'last 2 versions', '> 1%', 'ie 8'
      ))
      .pipe(gulp.dest(styles_output));

  if (!just_building) {
    stream.pipe(livereload());
  }
});
Example #21
0
gulp.task('sass', function() {
  return sass(paths.scss, {
      sourcemap: true,
      bundleExec: true,
      style: 'compressed',
      compass: true
    })
    .on('error', function (err) {
      console.log(err.message);
    })
    .pipe(plumber())
    .pipe(cached())
    .pipe(filelog())
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.css))
    .pipe(reload());
});
Example #22
0
 injectors.gulp.watch(watchpath, function (change) {
     var result = resloveCssPath(rootpath, change.path);
     var csspath = result.csspath;
     console.log(csspath);
     
     return sass(srcpath, {
         require: ["sass-json-vars", "sass-globbing", "sass/zhilizhili"],
         verbose: true
     })
         .on('error', sass.logError)
         .pipe(postcss([ autoprefixer({ browsers: ['> 1%',  'ios >= 7'] }) ]))
         .pipe(cleanCSS({compatibility: 'ie8'}))
         .pipe(rename(function (path) {
             path.basename = path.basename + "";
         }))
         .pipe(injectors.gulp.dest(destfolder));
 });
Example #23
0
	gulp.task('style', function () {
		return sass(assetsDir + '/sass/style.scss', {
			sourcemap  : config.sass.sourcemap,
			lineNumbers: config.sass.lineNumbers,
			container  : 'gulp-ruby-sass-style'
		})
			.on('error', function (err) {
				console.error('Error', err.message);
				notify.forFailedTests(err, 'petrieSass');
				this.emit('end');
			})
			.pipe(sourcemaps.write('./', {
				includeContent: true,
				sourceRoot    : config.debug ? paths.sass : paths.css
			}))
			.pipe(gulp.dest(paths.css))
			.pipe(notify.forPassedTests('petrieSass'));
	});
Example #24
0
gulp.task('old', function(){
	return sass('scss/styles.scss', { style: 'expanded' })
		.on('error', function(err){
			notify.onError({
				title: 'Error: sass',
				message: '<%= error.message %>'
			})(err);
			this.emit('end');
		})
		//.pipe(sourcemaps.write())
		// .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ]))
		.pipe(gulp.dest('css'))
		.pipe(notify({
			title: 'Success: sass',
			message: 'SASS compiled'
		}))
		.pipe(browserSync.reload({stream:true}));
});
Example #25
0
gulp.task('styles', ['cleanStyles'], function() {
  return sass(srcAssets.styles)
    .pipe($.plumber({errorHandler: errorAlert}))
    .pipe($.autoprefixer({
      browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Android >= 4']
    }))
    .pipe($.minifyCss())
    .pipe($.rev())
    .pipe($.rename({
      suffix: ".min"
    }))
    .pipe(gulp.dest(distAssets.styles))
    .pipe($.notify({
        title: "Stylesheets recompiled",
        message: "<%= file.relative %>",
        sound: "Glass"
    }));
});
Example #26
0
gulp.task('styles', function() {
    sass(path.join(srcPath,'scss'), {
      loadPath: ['bower_components'],
      style: 'expanded',
      require: ['susy']
    })
    .on('error', handleErrors)
    .pipe(autoprefixer('last 2 versions', 'Explorer >= 8'))
    .pipe(gulp.dest(path.join(dstPath,'css')));

    return gulp.src([
      path.join(dstPath,'css/objects/normalize.css'),
      path.join(dstPath,'css/objects/reset.css'),
      path.join(dstPath,'css/main.css')
    ])
    .pipe(concat('site.css'))
    .pipe(gulp.dest(path.join(dstPath,'css')));
});
Example #27
0
gulp.task('styles', function(){
	return sass(paths.scss + 'main.scss', {
		style: 'expanded',
		sourcemap: true 
		})
		.pipe(autoprefixer('last 2 version'))
		.pipe(gulp.dest('src/css'))

		// prod
		.pipe(minifycss({
			keepSpecialComments: false,
			removeEmpty: true
		}))
		.pipe(rename({suffix: '.min'}))
		.pipe(gulp.dest(config.path.dist))
		.pipe(connect.reload())
		.on('error', gutil.log);
});
Example #28
0
 gulp.task(taskName, function () {
     gulp.src(_.map(files, function (file) {
             return config.source + '/scss/' + file;
         }))
         .pipe(sass({
             // isolate each group files
             // because the plugin puts all
             // generated css in a single tmp dir
             container: name
         }))
         .pipe(concat('sonata-page.' + name + '.css'))
         .pipe(banner())
         .pipe(gulp.dest(config.dest))
         .pipe(cssmin())
         .pipe(rename({ suffix: '.min' }))
         .pipe(banner())
         .pipe(gulp.dest(config.dest));
 });
Example #29
0
gulp.task('styles', function () {
	return gulp.src([source+'sass/**/*.scss'])
		.pipe(plumber())
		.pipe(sass({ style: 'expanded', }))
		.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
		.pipe(plumber.stop())
		.pipe(gulp.dest(source+'css'))
		.pipe(cmq()) // Combines Media Queries
		.pipe(reload({stream:true})) // Inject Styles when style file is created
		.pipe(rename({ suffix: '.min' }))
		.pipe(minifycss({keepBreaks:true}))
		.pipe(minifycss({ keepSpecialComments: 0 }))
		.pipe(rev())
		.pipe(assetManifest({bundleName: 'app_styles'}))
		.pipe(gulp.dest(source+'css'))
		.pipe(reload({stream:true})) // Inject Styles when min style file is created
		.pipe(notify({ message: 'Styles task complete', onLast: true }))
});
Example #30
0
module.exports = function(){

  var styles = gulp.src('public/src/scss/app.scss')
    .pipe(plumber())
    .pipe(sass())
    .pipe(prefix('last 1 version', '> 1%', 'ie 8', 'ie 7'))
    .on('error', notify.onError())
    .pipe(gulp.dest('public/dist/css'))
    .on('end', function (){
        if( global.lrserver ) {
          gulp.src('public/dist/css/app.css')
              .pipe(refresh(global.lrserver));
        }
      });

  return styles;

};