Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
width: 300px;
height: 300px;
line-height: 300px;

user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;

-webkit-user-drag: none;
-webkit-tap-highlight-color: transparent;
}
Expand Down
5 changes: 4 additions & 1 deletion stylelint-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"./tools/stylelint/no-top-level-ampersand-in-mixin/index.js"
],
"rules": {
"material/no-prefixes": [["last 2 versions", "not ie <= 10", "not ie_mob <= 10"]],
"material/no-prefixes": [true, {
"browsers": ["last 2 versions", "not ie <= 10", "not ie_mob <= 10"],
"filePattern": "**/!(*-example.css)"
}],
"material/selector-no-deep": true,
"material/no-nested-mixin": true,
"material/no-ampersand-beyond-selector-start": [true, {
Expand Down
13 changes: 11 additions & 2 deletions tools/stylelint/no-prefixes/no-prefixes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const stylelint = require('stylelint');
const NeedsPrefix = require('./needs-prefix');
const parseSelector = require('stylelint/lib/utils/parseSelector');
const minimatch = require('minimatch');

const ruleName = 'material/no-prefixes';
const messages = stylelint.utils.ruleMessages(ruleName, {
Expand All @@ -14,9 +15,17 @@ const messages = stylelint.utils.ruleMessages(ruleName, {
/**
* Stylelint plugin that warns for unprefixed CSS.
*/
const plugin = stylelint.createPlugin(ruleName, browsers => {
const plugin = stylelint.createPlugin(ruleName, (isEnabled, options) => {
return (root, result) => {
if (!stylelint.utils.validateOptions(result, ruleName, {})) return;
if (!isEnabled || !stylelint.utils.validateOptions(result, ruleName, {})) {
return;
}

const {browsers, filePattern} = options;

if (filePattern && !minimatch(root.source.input.file, filePattern)) {
return;
}

const needsPrefix = new NeedsPrefix(browsers);

Expand Down