diff --git a/examples/silly/.enb/make.js b/examples/silly/.enb/make.js index 4e482b0..e88b8b8 100644 --- a/examples/silly/.enb/make.js +++ b/examples/silly/.enb/make.js @@ -41,4 +41,25 @@ module.exports = function (config) { { path: 'blocks', check: true } ] }); + + var specsPostCSS = config.module('enb-bem-specs').createConfigurator('specs-postcss'); + + specsPostCSS.configure({ + langs: true, + destPath: 'postcss-set.specs', + levels: ['blocks'], + cssEngine: { + tech: require('enb-postcss/techs/enb-postcss'), + options: { + plugins: [ + require('postcss-import')() + ] + } + }, + sourceLevels: [ + { path: '../libs/bem-core/common.blocks', check: false }, + { path: '../libs/bem-pr/spec.blocks', check: false }, + { path: 'blocks', check: true } + ] + }); }; diff --git a/examples/silly/blocks/block/block.post.css b/examples/silly/blocks/block/block.post.css new file mode 100644 index 0000000..5719e88 --- /dev/null +++ b/examples/silly/blocks/block/block.post.css @@ -0,0 +1,3 @@ +.block { + color: red; +} diff --git a/lib/node-configurator.js b/lib/node-configurator.js index f256ede..b1a8320 100644 --- a/lib/node-configurator.js +++ b/lib/node-configurator.js @@ -21,7 +21,10 @@ var path = require('path'), htmlTechOptionNames: { bemjsonFile: 'bemjsonFile', templateFile: 'bemhtmlFile' } }, - css = require('enb-stylus/techs/stylus'), + cssEngineDefault = { + tech: require('enb-stylus/techs/stylus'), + options: {} + }, js = require('enb-js/techs/browser-js'), borschikJs = require('enb-borschik/techs/js-borschik-include'), @@ -39,6 +42,7 @@ exports.configure = function (config, options) { var root = config.getRootPath(), pattern = path.join(options.destPath, '*'), templateEngine = options.templateEngine || templateEngineDefault, + cssEngine = options.cssEngine || cssEngineDefault, sourceLevels = [].concat(options.sourceLevels), depsTech, htmlTechOpts = {}; @@ -207,7 +211,7 @@ exports.configure = function (config, options) { } // CSS - nodeConfig.addTech(css); + nodeConfig.addTech([cssEngine.tech, _.assign({}, cssEngine.options, { target: '?.css' })]); nodeConfig.addTargets([ '?.spec.js', '?.css', '?.html' diff --git a/package.json b/package.json index f02ae50..3a8ad97 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,11 @@ "enb": ">= 0.13.0 < 2.0.0", "enb-bh": "1.2.0", "enb-magic-factory": ">= 0.3.0 < 1.0.0", + "enb-postcss": "^1.1.0", "eslint": "2.5.3", "eslint-config-pedant": "0.1.1", - "jscs": "1.11.0" + "jscs": "1.11.0", + "postcss-import": "^8.1.2" }, "main": "lib/index.js", "scripts": { @@ -52,7 +54,7 @@ "lint": "eslint . && jscs .", "test-silly": "npm run clean && npm run fixtures && npm run build-examples && npm run clean && npm run build-examples-coverage", "fixtures": "cd examples && bower i", - "build-examples": "enb -d examples/silly make __magic__ set.specs && enb -d examples/silly make specs-bh", + "build-examples": "enb -d examples/silly make __magic__ set.specs && enb -d examples/silly make specs-bh && enb -d examples/silly make specs-postcss", "build-examples-coverage": "ISTANBUL_COVERAGE=yes npm run build-examples && istanbul report text --include examples/silly/coverage.json", "clean": "rm -rf examples/*/set.* && rm -rf examples/*/.enb/tmp && rm -rf examples/*/coverage.json" }