Skip to content

Commit

Permalink
Fixed #5 Add autoprefixer
Browse files Browse the repository at this point in the history
  • Loading branch information
xcatliu committed Aug 29, 2016
1 parent cd5189c commit 5a2b2ca
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 51 deletions.
122 changes: 100 additions & 22 deletions dist/mobi.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mobi.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mobi.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ const rimraf = require('rimraf');
const runSequence = require('run-sequence');
const ecstatic = require('ecstatic');
const http = require('http');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cleanCSS = require('gulp-clean-css');

const postcssConfig = [ autoprefixer({ browsers: [
'last 5 iOS versions',
'last 5 Android versions',
'last 5 ExplorerMobile versions',
'last 5 ChromeAndroid versions',
'last 5 FirefoxAndroid versions',
'last 5 OperaMobile versions',
'last 5 OperaMini versions',
'last 5 Samsung versions',
'last 5 UCAndroid versions',

'last 3 Chrome versions',
'last 3 Firefox versions',
'last 3 Safari versions',
] }) ];

const SRC_DIR = path.resolve(__dirname, 'src');
const DIST_DIR = path.resolve(__dirname, 'dist');
Expand All @@ -33,8 +52,8 @@ gulp.task('build', (done) => {

gulp.task('build:mobi', [
'clean:dist',
'build:mobi:compressed',
'build:mobi:sourcemaps',
'build:mobi:compressed',
]);

gulp.task('build:site', [
Expand All @@ -47,14 +66,15 @@ gulp.task('clean:dist', () => rimraf.sync(`${DIST_DIR}/**/*`));

gulp.task('clean:public', () => rimraf.sync(`${PUBLIC_DIR}/**/*`));

gulp.task('build:mobi:compressed', () => gulp.src(`${SRC_DIR}/mobi.scss`)
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
gulp.task('build:mobi:compressed', ['build:mobi:sourcemaps'], () => gulp.src(`${DIST_DIR}/mobi.css`)
.pipe(cleanCSS())
.pipe(rename('mobi.min.css'))
.pipe(gulp.dest(DIST_DIR)));

gulp.task('build:mobi:sourcemaps', () => gulp.src(`${SRC_DIR}/mobi.scss`)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(postcss(postcssConfig))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(DIST_DIR)));

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
},
"homepage": "http://mobicss.xcatliu.com",
"devDependencies": {
"autoprefixer": "^6.4.0",
"ecstatic": "^2.1.0",
"ejs": "^2.5.1",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.0.12",
"gulp-postcss": "^6.1.1",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.6.0",
Expand Down
Loading

0 comments on commit 5a2b2ca

Please sign in to comment.