0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00
wagtail/gulpfile.js/tasks/styles.js
Thibaud Colas 61b6de2e4e Tidy up new React + API explorer for mobile (fixes #3607) (#3635)
* Remove useless CSS declaration

* Remove commented out styles

* Merge duplicate declarations

* Remove even more commented out code

* Move footer mq to footer declaration

* Remove more useless code

* Stop vendor prefixing for IE below 11

* Remove useless vendor prefixing

* Merge identical declarations

* Fix 1px overflow in content wrapper

* Fix explorer scrolling when open on mobile

* Remove unused import

* Add Redux performance measurements to explorer menu

* Rewrite explorer reducer to avoid unnecessary operations

* Stop changing reducer state on every action regardless of type

* Remove redundant children.isFetching property in nodes reducer

* Remove redundant children.isLoaded property in nodes reducer

* Remove redundant children.isError property in nodes reducer

* Refactor nodes explorer reducer with sub-reducer

* Fix linting issue

* Remove unused class name

* Change default icon className from empty string to null

* Remove old TODO comment

* Hoist icons in ExplorerItem component for better performance

* Add comment

* Add tooling for performance measurement of React components

* Clean up explorer panel component definition

* Make performance measurements opt-in

* Improve alignment of page explorer menu on mobile

* Close explorer on touchend rather than touchstart

* Comment out performance measurement code

* Remove fade transition completely
2017-06-09 00:08:04 +03:00

51 lines
1.8 KiB
JavaScript

var gulp = require('gulp');
var sass = require('gulp-sass');
var config = require('../config');
var autoprefixer = require('gulp-autoprefixer');
var simpleCopyTask = require('../lib/simplyCopy');
var normalizePath = require('../lib/normalize-path');
var gutil = require('gulp-util');
var flatten = function(arrOfArr) {
return arrOfArr.reduce(function(flat, more) {
return flat.concat(more);
}, []);
};
gulp.task('styles', ['styles:sass', 'styles:css']);
gulp.task('styles:css', simpleCopyTask('css/**/*'));
gulp.task('styles:sass', function () {
// Wagtail Sass files include each other across applications,
// e.g. wagtailimages Sass files will include wagtailadmin/sass/mixins.scss
// Thus, each app is used as an includePath.
var includePaths = flatten(config.apps.map(function(app) { return app.scssIncludePaths(); }));
// Not all files in a directory need to be compiled, so each app defines
// its own Sass files that need to be compiled.
var sources = flatten(config.apps.map(function(app) { return app.scssSources(); }));
return gulp.src(sources)
.pipe(sass({
errLogToConsole: true,
includePaths: includePaths,
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 3 versions', 'ie 11'],
cascade: false
}))
.pipe(gulp.dest(function(file) {
// e.g. wagtailadmin/scss/core.scss -> wagtailadmin/css/core.css
// Changing the suffix is done by Sass automatically
return normalizePath(file.base)
.replace(
'/' + config.srcDir + '/',
'/' + config.destDir + '/'
)
.replace('/scss/', '/css/');
}))
.on('error', gutil.log);
});