From 2f63b254cfeac235d9d183d341cdc1bf7708ded0 Mon Sep 17 00:00:00 2001 From: Darius Tall Date: Fri, 24 Jun 2016 10:25:08 -0400 Subject: [PATCH 1/7] Add the ability to specify other postcss options (#99) * Add the ability to specify other postcss options * Fixed usage of postcss --- lib/style-rewriter.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/style-rewriter.js b/lib/style-rewriter.js index a212d0a..3639240 100644 --- a/lib/style-rewriter.js +++ b/lib/style-rewriter.js @@ -45,9 +45,16 @@ module.exports = function (id, css, scoped) { if (val) { return Promise.resolve(val) } else { - var plugins = options.postcss - ? options.postcss.slice() - : [] + var plugins = [] + var opts = {} + + if (options.postcss instanceof Array) { + plugins = options.postcss.slice() + } else if (options.postcss instanceof Object) { + plugins = options.postcss.plugins || [] + opts = options.postcss.options + } + // scoped css rewrite if (scoped) { plugins.push(addId) @@ -66,7 +73,7 @@ module.exports = function (id, css, scoped) { } currentId = id return postcss(plugins) - .process(css) + .process(css, opts) .then(function (res) { var val = { source: res.css, @@ -77,3 +84,4 @@ module.exports = function (id, css, scoped) { }) } } + From 184b906c74d4d91baee2ad0cc0b03a68c2f0770c Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 24 Jun 2016 10:27:24 -0400 Subject: [PATCH 2/7] 8.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e11b99f..bbdbffc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vueify", - "version": "8.5.4", + "version": "8.6.0", "description": "Vue component transform for Browserify", "main": "index.js", "repository": { From f38f00f49e8961d5e005bc030170e870caf94b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Vidic?= Date: Thu, 30 Jun 2016 08:28:47 -0700 Subject: [PATCH 3/7] babel is only one option. (#105) * babel is only one option. still default if installed. * Another remark. --- README.md | 6 +++--- lib/compiler.js | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da918e0..5a1f711 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ npm install vueify --save-dev browserify -t vueify -e src/main.js -o build/build.js ``` -If you are using npm 3+, it no longer auto install the peer dependencies. So you will also have to also install the babel-related dependencies: +If you are using npm 3+ and **babel**, it no longer auto install the peer dependencies. So you will also have to also install the babel-related dependencies: ``` bash npm install\ @@ -121,9 +121,9 @@ Make sure to have the `NODE_ENV` environment variable set to `"production"` when If you are using Gulp, note that `gulp --production` **does not** affect vueify; you still need to explicitly set `NODE_ENV=production`. -## ES2015 by Default +## ES2015 when `babel-core` installed -Vueify automatically transforms the JavaScript in your `*.vue` components using Babel. Write ES2015 today! +Vueify automatically transforms the JavaScript in your `*.vue` components using Babel when it is installed. Write ES2015 today! The default Babel (6) options used for Vue.js components are: diff --git a/lib/compiler.js b/lib/compiler.js index 09bb491..293eca7 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -22,6 +22,13 @@ try { hotReloadAPIPath = 'vueify/node_modules/vue-hot-reload-api' } +var hasBabel = true +try { + require('babel-core') +} catch (e) { + hasBabel = false +} + var htmlMinifyOptions = { collapseWhitespace: true, removeComments: true, @@ -291,7 +298,8 @@ function processStyle (node, filePath, id) { */ function processScript (node, filePath, content) { - var lang = checkLang(node) || 'babel' + var lang = checkLang(node) || (hasBabel ? 'babel' : null) + var script = checkSrc(node, filePath) if (!script) { script = parse5.serialize(node) From 6d08c98bf1e3db6a866b8a0a5f4fa2b5d7131926 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 30 Jun 2016 11:30:29 -0400 Subject: [PATCH 4/7] 8.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bbdbffc..6e9e0ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vueify", - "version": "8.6.0", + "version": "8.7.0", "description": "Vue component transform for Browserify", "main": "index.js", "repository": { From 977358b2427f816b8b9ea0a0bce3ae48541ada58 Mon Sep 17 00:00:00 2001 From: John Leung Date: Tue, 2 Aug 2016 17:23:56 -0700 Subject: [PATCH 5/7] Added livescript --- lib/compilers/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compilers/index.js b/lib/compilers/index.js index f7cbfa7..8f81d32 100644 --- a/lib/compilers/index.js +++ b/lib/compilers/index.js @@ -1,6 +1,7 @@ // built-in compilers module.exports = { coffee: require('./coffee'), + livescript: require('./livescript'), babel: require('./babel'), less: require('./less'), sass: require('./sass'), From ed48f20d3115a55c3d8a9b019a68d5275f0092a0 Mon Sep 17 00:00:00 2001 From: John Leung Date: Tue, 2 Aug 2016 17:32:11 -0700 Subject: [PATCH 6/7] Added livescript.js --- lib/compilers/livescript.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/compilers/livescript.js diff --git a/lib/compilers/livescript.js b/lib/compilers/livescript.js new file mode 100644 index 0000000..76a3bb4 --- /dev/null +++ b/lib/compilers/livescript.js @@ -0,0 +1,15 @@ +var options = require('./options') + +module.exports = function (raw, cb) { + try { + var ls = require('livescript') + } catch (err) { + return cb(err) + } + try { + var js = ls.compile(raw, options.coffee || {}) + } catch (err) { + return cb(err) + } + cb(null, js) +} From 92da54667800a2afe2802320796b58d8df9bcd33 Mon Sep 17 00:00:00 2001 From: John Leung Date: Tue, 2 Aug 2016 17:37:26 -0700 Subject: [PATCH 7/7] edited README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5a1f711..0694171 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ These are the built-in preprocessors: - jade - pug - coffee-script (use `coffee` in [config section](#configuring-options)) +- livescript ( lang="livescript" ) ## Autoprefix by Default