kopia lustrzana https://github.com/wagtail/wagtail
Fix sass->css output, use system paths.
rodzic
5465d2e11b
commit
202380f712
|
@ -8,6 +8,7 @@
|
|||
/wagtail.egg-info/
|
||||
/docs/_build/
|
||||
/.tox/
|
||||
/.venv
|
||||
/venv
|
||||
/node_modules/
|
||||
npm-debug.log*
|
||||
|
|
|
@ -23,16 +23,16 @@ App.prototype.scssSources = function() {
|
|||
|
||||
// All the Wagtail apps that contain static files
|
||||
var apps = [
|
||||
new App('wagtail/admin', {'appName': 'wagtailadmin'}),
|
||||
new App('wagtail/documents', {'appName': 'wagtaildocs'}),
|
||||
new App('wagtail/embeds', {'appName': 'wagtailembeds'}),
|
||||
new App('wagtail/images', {'appName': 'wagtailimages'}),
|
||||
new App('wagtail/search', {'appName': 'wagtailsearch'}),
|
||||
new App('wagtail/snippets', {'appName': 'wagtailsnippets'}),
|
||||
new App('wagtail/users', {'appName': 'wagtailusers'}),
|
||||
new App('wagtail/contrib/styleguide', {'appName': 'wagtailstyleguide'}),
|
||||
new App('wagtail/contrib/settings', {'appName': 'wagtailsettings'}),
|
||||
new App('wagtail/contrib/modeladmin', {'appName': 'wagtailmodeladmin'}),
|
||||
new App(path.join('wagtail', 'admin'), {'appName': 'wagtailadmin'}),
|
||||
new App(path.join('wagtail', 'documents'), {'appName': 'wagtaildocs'}),
|
||||
new App(path.join('wagtail', 'embeds'), {'appName': 'wagtailembeds'}),
|
||||
new App(path.join('wagtail', 'images'), {'appName': 'wagtailimages'}),
|
||||
new App(path.join('wagtail', 'search'), {'appName': 'wagtailsearch'}),
|
||||
new App(path.join('wagtail', 'snippets'), {'appName': 'wagtailsnippets'}),
|
||||
new App(path.join('wagtail', 'users'), {'appName': 'wagtailusers'}),
|
||||
new App(path.join('wagtail', 'contrib', 'styleguide'), {'appName': 'wagtailstyleguide'}),
|
||||
new App(path.join('wagtail', 'contrib', 'settings'), {'appName': 'wagtailsettings'}),
|
||||
new App(path.join('wagtail', 'contrib', 'modeladmin'), {'appName': 'wagtailmodeladmin'}),
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
var quoteRegExp = function (str) {
|
||||
return (str + '').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
|
||||
};
|
||||
var re = new RegExp(quoteRegExp(require("path").sep), "g");
|
||||
|
||||
/**
|
||||
* Normalize path separators to forward slashes
|
||||
* @param path A path in either Windows or POSIX format
|
||||
* @returns {string} A path in POSIX format
|
||||
*/
|
||||
module.exports = function (path) {
|
||||
return ("" + path).replace(re, "/");
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
var path = require('path');
|
||||
var rename = require('gulp-rename');
|
||||
var config = require('../config');
|
||||
|
||||
/**
|
||||
* Returns a configured gulp-rename to pipe from asset sources to dest.
|
||||
* Usage: .pipe(renameSrcToDestScss())
|
||||
*/
|
||||
var renameSrcToDestScss = function(log) {
|
||||
return rename(function(filePath) {
|
||||
if (log) console.log(filePath.dirname + path.sep + filePath.basename + filePath.extname);
|
||||
filePath.dirname = filePath.dirname.replace(
|
||||
path.sep + config.srcDir + path.sep,
|
||||
path.sep + config.destDir + path.sep
|
||||
).replace(path.sep + "scss", path.sep + "css");
|
||||
if (log) console.log(filePath.dirname);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = renameSrcToDestScss;
|
|
@ -1,6 +1,6 @@
|
|||
var path = require('path');
|
||||
var rename = require('gulp-rename');
|
||||
var config = require('../config');
|
||||
var normalizePath = require('../lib/normalize-path');
|
||||
|
||||
/**
|
||||
* Returns a configured gulp-rename to pipe from asset sources to dest.
|
||||
|
@ -8,10 +8,10 @@ var normalizePath = require('../lib/normalize-path');
|
|||
*/
|
||||
var renameSrcToDest = function(log) {
|
||||
return rename(function(filePath) {
|
||||
if (log) console.log(filePath.dirname + '/' + filePath.basename + filePath.extname);
|
||||
filePath.dirname = normalizePath(filePath.dirname).replace(
|
||||
'/' + config.srcDir + '/',
|
||||
'/' + config.destDir + '/');
|
||||
if (log) console.log(filePath.dirname + path.sep + filePath.basename + filePath.extname);
|
||||
filePath.dirname = filePath.dirname.replace(
|
||||
path.sep + config.srcDir + path.sep,
|
||||
path.sep + config.destDir + path.sep);
|
||||
if (log) console.log(filePath.dirname);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -10,8 +10,8 @@ var sourcemaps = require('gulp-sourcemaps');
|
|||
var size = require('gulp-size');
|
||||
var config = require('../config');
|
||||
var simpleCopyTask = require('../lib/simplyCopy');
|
||||
var normalizePath = require('../lib/normalize-path');
|
||||
var renameSrcToDest = require('../lib/rename-src-to-dest');
|
||||
var renameSrcToDestScss = require('../lib/rename-src-to-dest-scss');
|
||||
var gutil = require('gulp-util');
|
||||
|
||||
var flatten = function(arrOfArr) {
|
||||
|
@ -61,7 +61,7 @@ gulp.task('styles:sass', function () {
|
|||
// its own Sass files that need to be compiled.
|
||||
var sources = flatten(config.apps.map(function(app) { return app.scssSources(); }));
|
||||
|
||||
return gulp.src(sources)
|
||||
return gulp.src(sources, {base: '.'})
|
||||
.pipe(config.isProduction ? gutil.noop() : sourcemaps.init())
|
||||
.pipe(sass({
|
||||
errLogToConsole: true,
|
||||
|
@ -76,16 +76,8 @@ gulp.task('styles:sass', function () {
|
|||
]))
|
||||
.pipe(size({ title: 'Wagtail CSS' }))
|
||||
.pipe(config.isProduction ? gutil.noop() : sourcemaps.write())
|
||||
.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');
|
||||
}))
|
||||
.pipe(renameSrcToDestScss())
|
||||
.pipe(gulp.dest("."))
|
||||
.on('error', gutil.log);
|
||||
});
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue