Skip to content

Commit

Permalink
CSS prefixer
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonSermyazhko committed Aug 23, 2018
1 parent fa62205 commit c998a98
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
35 changes: 28 additions & 7 deletions build/gulp/style-compiler.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
var gulp = require('gulp');
var path = require('path');
var context = require('./context.js');
var autoPrefix = require('gulp-autoprefixer');

function runStyleCompiler(command, params, callback) {
var spawn = require('child_process').spawn;
var process = spawn(
'dotnet',
['build/style-compiler/bin/style-compiler.dll', command].concat(params),
{ stdio: 'inherit' }
);
var spawn = require('child_process').spawn,
process = spawn(
'dotnet',
['build/style-compiler/bin/style-compiler.dll', command].concat(params),
{ stdio: 'inherit' }
);

process.on('exit', function(code) {
if(code === 0) {
callback();
addCssPrefixes(params, callback);
} else {
callback('Style compiler failed');
}
});
}

function addCssPrefixes(params, callback) {
var outputPath;

if(params.length > 0) {
outputPath = params.find(param => !!param.match("--output-path"));
outputPath = outputPath && outputPath.replace("--output-path=", "");
}
if(outputPath) {
gulp.src(outputPath + "/*.css")
.pipe(autoPrefix())
.pipe(gulp.dest(function(file) {
return file.base;
}).on('end', function() {
callback();
})).on('error', function() {
callback(' Autoprefixer failed');
});
}
}

function generateCustomTheme(baseTheme, baseColorScheme, baseSizeScheme, customMetaPath, outputPath, callback) {
var params = [
'--base-theme=' + baseTheme,
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"gulp-typescript": "^3.0.2",
"gulp-uglify": "^1.5.3",
"gulp-watch": "^5.0.0",
"gulp-autoprefixer": "^5.0.0",
"handlebars": "4.0.11",
"hogan.js": "3.0.2",
"jquery": "3.1.1",
Expand Down Expand Up @@ -104,5 +105,11 @@
"dev": "gulp dev",
"test-env": "node testing/launch"
},
"browserslist": [
"last 1 version",
"ios > 6",
"ie > 10",
"> 1%"
],
"pre-commit": "lint-staged"
}

0 comments on commit c998a98

Please sign in to comment.