From 3fb3936aa9c6abfb493eca070d3ca2618be09ad3 Mon Sep 17 00:00:00 2001 From: jiaming743 <743192023@qq.com> Date: Wed, 3 Jul 2019 18:56:55 +0800 Subject: [PATCH] update prepublish process --- publish/copyAndAbstractLess.js | 19 +++++++++++++++---- publish/plugin/fs.js | 17 ++++++++++++++++- publish/plugin/print.js | 4 +--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/publish/copyAndAbstractLess.js b/publish/copyAndAbstractLess.js index 9a1192d..e257486 100644 --- a/publish/copyAndAbstractLess.js +++ b/publish/copyAndAbstractLess.js @@ -1,5 +1,6 @@ -const { copyDir, fileForEach } = require('./plugin/fs') -const { print } = require('./plugin/print') +const { copyDir, fileForEach, readFile } = require('./plugin/fs') +const print = require('./plugin/print') +const path = require('path') const PACKAGE_SRC = './src' const COMPILE_SRC = './lib' @@ -13,8 +14,18 @@ async function start () { return false } - fileForEach(COMPILE_SRC, src => { - print.tip(src) + const abstract = await abstractLessFromVue() +} + +async function abstractLessFromVue () { + fileForEach(COMPILE_SRC, async src => { + if (path.extname(src) !== '.vue') return + + const data = await readFile(src).split('