Готовы конфиг

Структура


# Публичные файлы

# lesss
app/dist
app/dist/css
app/dist/js
app/dist/images
app/dist/fonts

# scss
app/fonts
app/sass/app.scss
app/less/all.less
app/js
app/images
// package.json

{
  "name": "www",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "gulp-sass": "^3.1.0"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-imagemin": "^4.0.0",
    "gulp-less-glob": "^1.0.0",
    "gulp-sass": "^3.1.0",
    "gulp-watch": "^4.3.11",
    "gulp-watch-sass": "^1.3.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}
'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var less = require('gulp-less');
var path = require('path');
var lessGlob = require('gulp-less-glob');
var fontAwesome = require('node-font-awesome');
var imagemin = require('gulp-imagemin');

var concat = require('gulp-concat'),  // объединяет файлы в один бандл
  minifyCSS = require('gulp-minify-css'),  // сжимает, оптимизирует
  rename = require("gulp-rename");  // переименовывает

gulp.task('sass', function () {
  return gulp.src('./app/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    //.pipe(minifyCSS())
    .pipe(rename({suffix: ".min"}))
    .pipe(sass({
      includePaths: [fontAwesome.scssPath]
    }))
    .pipe(gulp.dest('./app/dist/css'));
});

gulp.task('sass:watch', function () {
  gulp.watch('./app/sass/**/*.scss', ['sass']);
});

gulp.task('images', function () {
  gulp.src('./app/images/*')
    .pipe(imagemin())
    .pipe(gulp.dest('./app/dist/images'))
});

gulp.task('fonts', function() {
  gulp.src(fontAwesome.fonts)
    .pipe(gulp.dest('./app/dist/fonts'));
});

gulp.task('less', function () {
  return gulp
    .src('./app/less/all.less')
    .pipe(lessGlob())
    .pipe(less())
    .pipe(gulp.dest('./app/dist/css'));
});
18 декабря 2017, 06:56    241



Наверх