Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/*.js
config/*.js
example/*.js
dist
43 changes: 0 additions & 43 deletions build/build.js

This file was deleted.

26 changes: 24 additions & 2 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const {
buildWxss,
buildWxml,
buildImage,
buildJson,
buildJs,
copyStatic,
clean,
copy
} = require('./build');
} = require('./task');
const {
series,
parallel,
Expand All @@ -30,6 +34,23 @@ module.exports = {
`!${srcProPath}/_*.less`,
distPath
),
buildWxml(
`${srcProPath}/*.wxml`,
`!${srcProPath}/_*.wxml`,
distPath
),
buildImage(
`${srcProPath}/*.png`,
distPath
),
buildJson(
`${srcProPath}/*.json`,
distPath
),
buildJs(
`${srcProPath}/*.js`,
distPath
),
copyStatic(
srcProPath,
distPath
Expand All @@ -46,7 +67,8 @@ module.exports = {
),
copyStatic(
srcDevPath,
examplePath
examplePath,
'dev'
)
)
),
Expand Down
83 changes: 83 additions & 0 deletions build/task.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
const {
src,
dest,
parallel
} = require('gulp');
const less = require('gulp-less');
const imagemin = require('gulp-imagemin');
const cssmin = require('gulp-clean-css');
const jsonmin = require('gulp-jsonminify');
const jsmin = require('gulp-uglify-es').default;
const wxmlmin = require('gulp-htmlmin');
const rename = require('gulp-rename');
const del = require('del');

const buildWxss = (srcPath, remainPath, distPath) => () =>
src([srcPath, remainPath])
.pipe(less())
.pipe(cssmin())
.pipe(rename(srcPath => {
srcPath.extname = '.wxss';
}))
.pipe(dest(distPath));

const copy = (srcPath, distPath, ext) => () =>
src(`${srcPath}/*.${ext}`)
.pipe(dest(distPath));

const buildWxml = (srcPath, remainPath, distPath) => () =>
src([srcPath, remainPath])
.pipe(wxmlmin({
removeComments: true,
// collapseWhitespace: true,
keepClosingSlash: true,
caseSensitive: true
}))
.pipe(dest(distPath));

const buildJson = (srcPath, distPath) => () =>
src(srcPath)
.pipe(jsonmin())
.pipe(dest(distPath));

const buildJs = (srcPath, distPath) => () =>
src(srcPath)
.pipe(jsmin())
.pipe(dest(distPath));

const buildImage = (srcPath, distPath) => () =>
src(srcPath)
.pipe(imagemin())
.pipe(dest(distPath));

const copyStatic = (srcPath, distPath, env = 'build') => {
if (env === 'build') {
return parallel(
copy(srcPath, distPath, 'wxs')
);
} else {
return parallel(
copy(srcPath, distPath, 'wxml'),
copy(srcPath, distPath, 'wxs'),
copy(srcPath, distPath, 'json'),
copy(srcPath, distPath, 'js'),
copy(srcPath, distPath, 'png')
);
}
}

const clean = (cleanPath) => () =>
del([cleanPath], {
force: true
});

module.exports = {
buildWxss,
buildWxml,
buildImage,
buildJson,
buildJs,
copyStatic,
clean,
copy
};
125 changes: 1 addition & 124 deletions dist/action-sheet/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions dist/action-sheet/index.json
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{
"component": true,
"usingComponents": {
"l-icon":"../icon/index",
"l-popup":"../popup/index",
"l-button":"../button/index"
}
}
{"component":true,"usingComponents":{"l-icon":"../icon/index","l-popup":"../popup/index","l-button":"../button/index"} }
11 changes: 3 additions & 8 deletions dist/action-sheet/index.wxml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<l-popup show="{{show}}" showMask="{{true}}" contentAlign="bottom" locked="{{locked}}" bind:lintap="handleClickPopUp" z-index="{{zIndex}}">
<view class='l-action-sheet'>
<view class="l-item-button l-class-title l-title-class" wx:if="{{title}}">
<view class="l-action-sheet">
<view class="l-item-button l-class-title l-title-class" wx:if="{{title}}">
{{ title }}
</view>
<view wx:for="{{ itemList }}" wx:key="name" hover-class="{{isHover?'list-hover':''}}">
<l-button bind:lintap="handleClickItem" data-index="{{ index }}" data-item="{{ item }}" open-type="{{ item.openType }}" icon="{{ item.icon }}" type="ghost" size="large" special="{{true}}" long>
<view style="{{ item.color ? 'color: ' + item.color : '' }}" class="l-item-button l-class-item l-item-class {{item.image || item.icon ? 'l-image-button':''}}">
<image wx:if="{{item.image}}" class="l-button-image" src="{{item.image}}" style="{{item.imageStyle}}"/>
<l-icon
wx:elif="{{ item.icon }}"
name="{{ item.icon }}"
l-class="l-item-button"
size="{{ item.iconSize }}"
color="{{item.iconColor?item.iconColor:item.color}}"></l-icon>
<l-icon wx:elif="{{ item.icon }}" name="{{ item.icon }}" l-class="l-item-button" size="{{ item.iconSize }}" color="{{item.iconColor?item.iconColor:item.color}}"></l-icon>
<text class="l-button-text">{{ item.name }}</text>
</view>
</l-button>
Expand Down
2 changes: 1 addition & 1 deletion dist/action-sheet/index.wxss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.l-action-sheet{background:#f7f7f7}.l-item-button{height:88rpx;line-height:88rpx;text-align:center;background:#fff;border-bottom:2rpx solid #f3f3f3;font-size:28rpx;color:#45526b;display:flex;align-items:center;justify-content:center;width:100%}.l-cancel{margin-top:12rpx}.l-cancel-x .l-item-button{padding-bottom:44rpx}.l-image-button>text{margin-left:20rpx}.list-hover{opacity:.8}
.l-action-sheet{background:#f7f7f7}.l-item-button{height:88rpx;line-height:88rpx;text-align:center;background:#fff;border-bottom:2rpx solid #f3f3f3;font-size:28rpx;color:#45526b;display:flex;align-items:center;justify-content:center;width:100%;overflow:hidden}.l-cancel{margin-top:12rpx}.l-cancel-x .l-item-button{padding-bottom:44rpx}.l-image-button>text{margin-left:20rpx}.list-hover{opacity:.8}
Loading