-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: reorganization order and add prettier
- Loading branch information
1 parent
9a97115
commit acc682b
Showing
4 changed files
with
60 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
**/*.svg | ||
package.json | ||
/dist | ||
.dockerignore | ||
.DS_Store | ||
.eslintignore | ||
*.png | ||
*.toml | ||
docker | ||
.editorconfig | ||
Dockerfile* | ||
.gitignore | ||
.prettierignore | ||
LICENSE | ||
.eslintcache | ||
*.lock | ||
yarn-error.log | ||
.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
module.exports = { | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
printWidth: 100, | ||
proseWrap: 'never', | ||
overrides: [ | ||
{ | ||
files: '.prettierrc', | ||
options: { | ||
parser: 'json', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
const { src, dest,parallel } = require('gulp'); | ||
const { src, dest, parallel } = require('gulp'); | ||
const through = require('through2'); | ||
const sass=require('gulp-sass'); | ||
const sass = require('gulp-sass'); | ||
const concat = require('gulp-concat'); | ||
function outputStyleTask () { | ||
function outputStyleTask() { | ||
return src(['src/components/**/*.scss']) | ||
.pipe(through.obj(function (file, _, callback) { | ||
const pathName=file.relative.split('/')[0] | ||
this.push(pathName) | ||
callback() | ||
})) | ||
.on('data', (data) => { | ||
convertStyles(data) | ||
}) | ||
.pipe( | ||
through.obj(function(file, _, callback) { | ||
const pathName = file.relative.split('/')[0]; | ||
this.push(pathName); | ||
callback(); | ||
}), | ||
) | ||
.on('data', data => { | ||
convertStyles(data); | ||
}); | ||
} | ||
function convertStyles(data){ | ||
return src(['src/components/'+String(data)+'/*.scss']) | ||
.pipe(dest('lib/'+String(data)+'/style/')) | ||
.pipe(sass()) | ||
.pipe(dest('lib/'+String(data)+'/style/')) | ||
function convertStyles(data) { | ||
return src(['src/components/' + String(data) + '/*.scss']) | ||
.pipe(dest('lib/' + String(data) + '/style/')) | ||
.pipe(sass()) | ||
.pipe(dest('lib/' + String(data) + '/style/')); | ||
} | ||
|
||
//管道输出后会引用新位置,因此css和scss单独两个task | ||
function globalSass(){ | ||
function globalSass() { | ||
return src('src/components/**/*.scss') //建议单独建个文件夹摆放,考虑到其他项目应用时也需相应更改,所以暂时先放打包文件根目录 | ||
.pipe(concat('index.scss')) | ||
.pipe(dest('lib')) | ||
.pipe(concat('index.scss')) | ||
.pipe(dest('lib')); | ||
} | ||
|
||
function globalCss(){ | ||
function globalCss() { | ||
return src('src/components/**/*.scss') | ||
.pipe(concat('index.css')) | ||
.pipe(sass()) | ||
.pipe(dest('lib')) | ||
.pipe(concat('index.css')) | ||
.pipe(sass()) | ||
.pipe(dest('lib')); | ||
} | ||
exports.default = parallel(outputStyleTask,globalCss,globalSass) | ||
exports.default = parallel(outputStyleTask, globalCss, globalSass); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters