Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add autoprefixer to gulp #1505

Merged
merged 2 commits into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"fs-extra": "^0.26.5",
"glob": "^6.0.4",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean": "^0.3.2",
"gulp-sass": "^2.3.2",
"gulp-server-livereload": "^1.8.2",
Expand Down
7 changes: 2 additions & 5 deletions src/lib/slide-toggle/slide-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ $md-slide-toggle-margin: 16px !default;

white-space: nowrap;

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

outline: none;
Expand Down
4 changes: 4 additions & 0 deletions tools/gulp/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export const SOURCE_ROOT = join(PROJECT_ROOT, 'src');
export const DIST_ROOT = join(PROJECT_ROOT, 'dist');
export const DIST_COMPONENTS_ROOT = join(DIST_ROOT, '@angular/material');

export const SASS_AUTOPREFIXER_OPTIONS = {
browsers: ['last 2 versions'],
cascade: false,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, we need to explicitly exclude IE10 and mobile IE because autoprefixer considers "IE" and "Edge" to be separate browsers, thus IE10 falls within the last two versions. This is necessary to prevent it from adding the outdated ms-flex prefixed rules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Just took a look at https://github.com/ai/browserslist and you're right.


export const NPM_VENDOR_FILES = [
'@angular', 'core-js/client', 'hammerjs', 'rxjs', 'systemjs/dist', 'zone.js/dist'
Expand Down
4 changes: 3 additions & 1 deletion tools/gulp/task_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as gulp from 'gulp';
import * as gulpTs from 'gulp-typescript';
import * as path from 'path';

import {NPM_VENDOR_FILES, PROJECT_ROOT, DIST_ROOT} from './constants';
import {NPM_VENDOR_FILES, PROJECT_ROOT, DIST_ROOT, SASS_AUTOPREFIXER_OPTIONS} from './constants';


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


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