mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-11 12:17:37 +03:00
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
|
|
////////////////////////////////
|
|
//Setup//
|
|
////////////////////////////////
|
|
|
|
// Plugins
|
|
var gulp = require('gulp'),
|
|
pjson = require('./package.json'),
|
|
gutil = require('gulp-util'),
|
|
sass = require('gulp-sass'),
|
|
autoprefixer = require('gulp-autoprefixer'),
|
|
cssnano = require('gulp-cssnano'),
|
|
rename = require('gulp-rename'),
|
|
del = require('del'),
|
|
plumber = require('gulp-plumber'),
|
|
pixrem = require('gulp-pixrem'),
|
|
browserSync = require('browser-sync');
|
|
|
|
|
|
// Relative paths function
|
|
var pathsConfig = function (appName) {
|
|
this.app = "./" + (appName || pjson.name);
|
|
|
|
return {
|
|
app: this.app,
|
|
templates: this.app + '/templates',
|
|
css: this.app + '/static/css',
|
|
sass: this.app + '/static/sass',
|
|
fonts: this.app + '/static/fonts',
|
|
images: this.app + '/static/images',
|
|
js: this.app + '/static/js',
|
|
}
|
|
};
|
|
|
|
var paths = pathsConfig();
|
|
|
|
////////////////////////////////
|
|
//Tasks//
|
|
////////////////////////////////
|
|
|
|
// Styles
|
|
gulp.task('styles', function() {
|
|
return gulp.src(paths.sass + '/project.scss', { style: 'expanded' })
|
|
.pipe(sass().on('error', sass.logError))
|
|
.pipe(plumber()) // It checks for errors
|
|
.pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes
|
|
.pipe(pixrem()) // add fallbacks for rem units
|
|
.pipe(gulp.dest('./static/css/'))
|
|
.pipe(rename({ suffix: '.min' }))
|
|
.pipe(cssnano()) // Minifies the result
|
|
.pipe(gulp.dest('./static/css/'));
|
|
});
|