gulp-ruby-sass编译到错误的目录

时间:2016-12-05 23:48:19

标签: sass gulp gulp-watch gulp-ruby-sass

我从这里https://github.com/expressly/angular-browserify-seed分叉了github repo,安装了所有东西,但是gulp无法正常工作。问题是,如果我在app.scss(src样式文件)中更改某些内容,gulp将其编译为不构建文件夹,而是编译

gulp-ruby-sass: write ../../../../../BicMitchup/AppData/Local/Temp/gulp-ruby-sass/app.css

gulpfile导入了很多不同的文件,这真的很大,但是我看到问题只出现在styles任务中。以下是此任务的代码

'use strict';

var gulp = require('gulp');
var gulpif = require('gulp-if');
var rename = require('gulp-rename');
var csso = require('gulp-csso');
var autoprefixer = require('gulp-autoprefixer');
var sass = require('gulp-ruby-sass');

var sassOptions = {
    style: 'compressed',
    'sourcemap=none': true
};

function handleError(err) {
    console.log(err.toString());
    this.emit('end');
}

module.exports = gulp.task('styles', function () {
    return gulp.src(config.paths.src.styles)
        .pipe(sass(sassOptions).on('error', handleError))
        .pipe(autoprefixer('last 1 version'))
        .pipe(gulpif(release, csso()))
        .pipe(gulpif(release, rename(config.filenames.release.styles), rename(config.filenames.build.styles)))
        .pipe(gulpif(release, gulp.dest(config.paths.dest.release.styles), gulp.dest(config.paths.dest.build.styles)));
});
我为此花了四个小时,它弄坏了我的脑袋。没有错误,只是错误的目标文件夹。这是包含所有路径的配置文件。

global.SRC_FOLDER = 'src';
global.BUILD_FOLDER = 'build';
global.RELEASE_FOLDER = 'release';
global.TMP_FOLDER = 'tmp';

global.config = {
    paths: {
        src: {
            index: SRC_FOLDER + '/index.html',
            assets: [SRC_FOLDER + '/assets/**/*', '!' + SRC_FOLDER + '/assets/images/**/*'],
            images: SRC_FOLDER + '/assets/images/**/*',
            scripts: SRC_FOLDER + '/modules/**/*.js',
            bowerStyles: ['bower_components/**/*.min.css', "bower_components/material-date-picker/app/styles/mbdatepicker.css"],
            styles: SRC_FOLDER + '/styles/app.scss',
            stylesGlob: SRC_FOLDER + '/styles/**/*.scss',
            templates: SRC_FOLDER + '/modules/**/*.html',
            templatesHTML: SRC_FOLDER + '/modules/**/*.html',
            templatesCompiled: TMP_FOLDER,
            livereload: [BUILD_FOLDER + '/**/*', '!' + BUILD_FOLDER + '/assets/**/*'],
            modules: './' + SRC_FOLDER + '/modules/index.js',
            config: SRC_FOLDER + '/modules/app/config.json'
        },
        dest: {
            build: {
                styles: BUILD_FOLDER,
                scripts: BUILD_FOLDER,
                images: BUILD_FOLDER + '/assets/images',
                assets: BUILD_FOLDER + '/assets',
                index: BUILD_FOLDER,
                server: BUILD_FOLDER
            },
            release: {
                styles: RELEASE_FOLDER,
                scripts: RELEASE_FOLDER,
                images: RELEASE_FOLDER + '/assets/images',
                assets: RELEASE_FOLDER + '/assets',
                index: RELEASE_FOLDER,
                server: RELEASE_FOLDER
            }
        }
    },
    filenames: {
        build: {
            styles: 'bundle.css',
            bowerStyles: 'vendor.css',
            scripts: 'bundle.js',
            config: 'config.js'
        },
        release: {
            styles: 'bundle.min.css',
            bowerStyles: 'vendor.min.css',
            scripts: 'bundle.min.js',
            config: 'config.min.js'
        },
        templates: {
            compiled: 'templates.js',
            angular: {
                moduleName: 'app.templates',
                prefix: '',
                stripPrefix: 'app/'
            }
        }
    },
    ports: {
        staticServer: 1337,
        livereloadServer: 35729
    }
};

红宝石或宝石可能有问题吗?有人可以帮忙吗?感谢

0 个答案:

没有答案