var cooking = require('cooking'); var path = require('path'); var md = require('markdown-it')(); var Components = require('../components.json'); var striptags = require('../examples/utils/strip-tags'); function convert(str) { str = str.replace(/()(\w{4});/gi, function($0) { return String.fromCharCode(parseInt(encodeURIComponent($0).replace(/(%26%23x)(\w{4})(%3B)/g, '$2'), 16)); }); return str; } cooking.set({ entry: './examples/entry.js', dist: './examples/element-ui/', template: './examples/index.tpl', publicPath: '/', hash: true, devServer: { port: 8085, log: false, publicPath: '/' }, minimize: true, chunk: true, extractCSS: true, sourceMap: true, extends: ['vue2', 'lint'], postcss: function(webapck) { return [ require('postcss-salad')({ browser: ['ie > 8', 'last 2 version'], features: { 'partialImport': { addDependencyTo: webapck }, 'bem': { 'shortcuts': { 'component': 'b', 'modifier': 'm', 'descendent': 'e' }, 'separators': { 'descendent': '__', 'modifier': '--' } } } }) ]; } }); cooking.add('loader.md', { test: /\.md$/, loader: 'vue-markdown-loader' }); cooking.add('vueMarkdown', { use: [ [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 html = convert(striptags(tokens[idx + 1].content, 'script')); var descriptionHTML = description ? '