fix postcss

This commit is contained in:
cookfront 2017-03-23 20:39:50 +08:00
parent b802041d6d
commit ffde7d562e
6 changed files with 70 additions and 165 deletions

View File

@ -11,7 +11,7 @@ var config = {
"rem": {"browsers": ["ie > 8", "last 2 versions"]}*/
};
// https://github.com/trysound/postcss-easy-import
var partialImport = require("postcss-easy-import");
var partialImport = require("postcss-easy-import")();
// 这不是bem虽然名字叫bem其实它是suit
// https://github.com/saladcss/saladcss-bem
@ -20,47 +20,15 @@ var bem = require("saladcss-bem")(config.bem);
// https://github.com/jonathantneal/precss
var precss = require("precss")();
// https://github.com/adam-h/postcss-sass-color-functions
var sassColor = require("postcss-sass-color-functions")();
// eleme的组件---
// https://npmjs.com/package/postcss-css-reset
// http://elemefe.github.io/postcss-salad/
var reset = require("postcss-css-reset")();
// eleme的组件---
// https://npmjs.com/package/postcss-utils
// http://elemefe.github.io/postcss-salad/
var utils = require("postcss-utils")();
// https://github.com/postcss/postcss-calc
var calc = require("postcss-calc")();
// https://github.com/maximkoretskiy/postcss-initial
var initial = require("postcss-initial")();
// https://github.com/trysound/postcss-inline-svg
var inlineSvg = require("postcss-inline-svg")();
// https://github.com/jonathantneal/postcss-short
var short = require("postcss-short")();
// eleme的组件---
// https://github.com/baiyaaaaa/postcss-shape
// http://elemefe.github.io/postcss-salad/
var shape = require("postcss-shape")();
// https://github.com/robwierzbowski/node-pixrem
var rem = require("pixrem")();
// https://github.com/postcss/autoprefixer
var autoprefixer = require("autoprefixer")();
// https://github.com/jo-asakura/postcss-neat
var neat = require("postcss-neat")();
module.exports = function (webpack) {
// 顺序很重要
return [partialImport({ addDependencyTo: webpack }), bem, precss, sassColor, reset,
utils, calc, initial, inlineSvg, short, shape, rem, autoprefixer, neat];
return [
partialImport,
bem,
precss,
autoprefixer
];
};

View File

@ -72,12 +72,67 @@ module.exports = {
}
]
},
devtool: 'source-map'
devtool: 'source-map',
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
options: {
postcss: getPoastcssPlugin,
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-vue-jsx']
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
vue: {
autoprefixer: false,
postcss: getPoastcssPlugin
},
vueMarkdown: {
use: [
[require('markdown-it-anchor'), {
level: 2,
slugify: slugify,
permalink: true,
permalinkBefore: true
}],
[require('markdown-it-container'), 'demo', {
validate: function(params) {
return params.trim().match(/^demo\s*(.*)$/);
},
render: function(tokens, idx) {
var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/);
if (tokens[idx].nesting === 1) {
var description = (m && m.length > 1) ? m[1] : '';
var content = tokens[idx + 1].content;
var html = convert(striptags.strip(content, ['script', 'style']));
return `<demo-block class="demo-box" description="${description}">
<div class="examples" slot="examples">${html}</div>
<div class="highlight" slot="highlight">`;
}
return '</div></demo-block>\n';
}
}]
],
preprocess: function(MarkdownIt, source) {
MarkdownIt.renderer.rules.table_open = function() {
return '<table class="table">';
};
MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence);
return source;
}
}
}
})
]
};
if (process.env.NODE_ENV === 'production') {
delete module.exports.devtool;
module.exports.plugins = [
module.exports.plugins = module.exports.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
@ -92,114 +147,5 @@ if (process.env.NODE_ENV === 'production') {
},
sourceMap: false
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
options: {
postcss: getPoastcssPlugin,
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-vue-jsx']
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
vue: {
autoprefixer: false,
postcss: getPoastcssPlugin
},
vueMarkdown: {
use: [
[require('markdown-it-anchor'), {
level: 2,
slugify: slugify,
permalink: true,
permalinkBefore: true
}],
[require('markdown-it-container'), 'demo', {
validate: function(params) {
return params.trim().match(/^demo\s*(.*)$/);
},
render: function(tokens, idx) {
var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/);
if (tokens[idx].nesting === 1) {
var description = (m && m.length > 1) ? m[1] : '';
var content = tokens[idx + 1].content;
var html = convert(striptags.strip(content, ['script', 'style']));
return `<demo-block class="demo-box" description="${description}">
<div class="examples" slot="examples">${html}</div>
<div class="highlight" slot="highlight">`;
]);
}
return '</div></demo-block>\n';
}
}]
],
preprocess: function(MarkdownIt, source) {
MarkdownIt.renderer.rules.table_open = function() {
return '<table class="table">';
};
MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence);
return source;
}
}
}
})
];
} else {
module.exports.plugins = [
new webpack.LoaderOptionsPlugin({
minimize: true,
options: {
postcss: getPoastcssPlugin,
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-vue-jsx']
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
vue: {
autoprefixer: false,
postcss: getPoastcssPlugin
},
vueMarkdown: {
use: [
[require('markdown-it-anchor'), {
level: 2,
slugify: slugify,
permalink: true,
permalinkBefore: true
}],
[require('markdown-it-container'), 'demo', {
validate: function(params) {
return params.trim().match(/^demo\s*(.*)$/);
},
render: function(tokens, idx) {
var m = tokens[idx].info.trim().match(/^demo\s*(.*)$/);
if (tokens[idx].nesting === 1) {
var description = (m && m.length > 1) ? m[1] : '';
var content = tokens[idx + 1].content;
var html = convert(striptags.strip(content, ['script', 'style']));
return `<demo-block class="demo-box" description="${description}">
<div class="examples" slot="examples">${html}</div>
<div class="highlight" slot="highlight">`;
}
return '</div></demo-block>\n';
}
}]
],
preprocess: function(MarkdownIt, source) {
MarkdownIt.renderer.rules.table_open = function() {
return '<table class="table">';
};
MarkdownIt.renderer.rules.fence = wrap(MarkdownIt.renderer.rules.fence);
return source;
}
}
}
})
];
};

2
docs/dist/0.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -103,21 +103,12 @@
"markdown-it-anchor": "^2.5.0",
"markdown-it-container": "^2.0.0",
"mocha": "^3.2.0",
"pixrem": "^3.0.0",
"postcss": "^5.1.2",
"postcss-calc": "^5.0.0",
"postcss-css-reset": "^1.0.2",
"postcss-easy-import": "^2.0.0",
"postcss-initial": "^1.3.1",
"postcss-inline-svg": "^1.4.0",
"postcss-loader": "^0.13.0",
"postcss-loader": "^1.3.3",
"postcss-neat": "^2.5.2",
"postcss-pseudo-class-any-link": "^1.0.0",
"postcss-sass-color-functions": "^1.1.0",
"postcss-scss": "^0.1.7",
"postcss-shape": "^0.0.1",
"postcss-short": "^1.4.0",
"postcss-utils": "^1.0.1",
"precss": "^1.4.0",
"prismjs": "^1.5.1",
"progress-bar-webpack-plugin": "^1.9.3",