Skip to content

Commit bfee9c3

Browse files
devversionjelbourn
authored andcommitted
chore: add autoprefixer to gulp (#1505)
* chore: add autoprefixer to gulp * At the time of moving to gulp, the autoprefixer is no longer running against the CSS. * Re-introducing the autoprefixer for the "latest two versions" as in the README stated, does make sure that each properties are working within the supported browsers. * Explicitly exclude IE 10 and lower browsers.
1 parent 3bb667e commit bfee9c3

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"fs-extra": "^0.26.5",
5656
"glob": "^6.0.4",
5757
"gulp": "^3.9.1",
58+
"gulp-autoprefixer": "^3.1.1",
5859
"gulp-clean": "^0.3.2",
5960
"gulp-sass": "^2.3.2",
6061
"gulp-server-livereload": "^1.8.2",

src/lib/slide-toggle/slide-toggle.scss

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ $md-slide-toggle-margin: 16px !default;
2525

2626
white-space: nowrap;
2727

28-
// Disable user selection to ensure that dragging is smooth without grabbing some elements
29-
// accidentally. Manually prefixing here, because the un-prefixed property is not supported yet.
30-
-webkit-user-select: none;
31-
-moz-user-select: none;
32-
-ms-user-select: none;
28+
// Disable user selection to ensure that dragging is smooth without grabbing
29+
// some elements accidentally.
3330
user-select: none;
3431

3532
outline: none;

tools/gulp/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ export const SOURCE_ROOT = join(PROJECT_ROOT, 'src');
66
export const DIST_ROOT = join(PROJECT_ROOT, 'dist');
77
export const DIST_COMPONENTS_ROOT = join(DIST_ROOT, '@angular/material');
88

9+
export const SASS_AUTOPREFIXER_OPTIONS = {
10+
browsers: [
11+
'last 2 versions',
12+
'not ie <= 10',
13+
'not ie_mob <= 10',
14+
],
15+
cascade: false,
16+
};
917

1018
export const NPM_VENDOR_FILES = [
1119
'@angular', 'core-js/client', 'hammerjs', 'rxjs', 'systemjs/dist', 'zone.js/dist'

tools/gulp/task_helpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as gulp from 'gulp';
44
import * as gulpTs from 'gulp-typescript';
55
import * as path from 'path';
66

7-
import {NPM_VENDOR_FILES, PROJECT_ROOT, DIST_ROOT} from './constants';
7+
import {NPM_VENDOR_FILES, PROJECT_ROOT, DIST_ROOT, SASS_AUTOPREFIXER_OPTIONS} from './constants';
88

99

1010
/** Those imports lack typings. */
@@ -14,6 +14,7 @@ const gulpRunSequence = require('run-sequence');
1414
const gulpSass = require('gulp-sass');
1515
const gulpServer = require('gulp-server-livereload');
1616
const gulpSourcemaps = require('gulp-sourcemaps');
17+
const gulpAutoprefixer = require('gulp-autoprefixer');
1718
const resolveBin = require('resolve-bin');
1819

1920

@@ -73,6 +74,7 @@ export function sassBuildTask(dest: string, root: string, includePaths: string[]
7374
return gulp.src(_globify(root, '**/*.scss'))
7475
.pipe(gulpSourcemaps.init())
7576
.pipe(gulpSass(sassOptions).on('error', gulpSass.logError))
77+
.pipe(gulpAutoprefixer(SASS_AUTOPREFIXER_OPTIONS))
7678
.pipe(gulpSourcemaps.write('.'))
7779
.pipe(gulp.dest(dest));
7880
};

0 commit comments

Comments
 (0)