Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/echofly/gulp-weapp-alias
Gulp plugin that lets you create custom aliases for wecaht weapp
https://github.com/echofly/gulp-weapp-alias
aliases gulp gulp-plugin weapp
Last synced: 9 days ago
JSON representation
Gulp plugin that lets you create custom aliases for wecaht weapp
- Host: GitHub
- URL: https://github.com/echofly/gulp-weapp-alias
- Owner: echofly
- License: mit
- Created: 2021-08-09T08:17:03.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-08-09T08:30:30.000Z (over 3 years ago)
- Last Synced: 2024-02-27T21:46:12.199Z (9 months ago)
- Topics: aliases, gulp, gulp-plugin, weapp
- Language: JavaScript
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Gulp Weapp Alias
Gulp plugin that lets you create custom aliases for wecaht weapp with an
@alias
rule. Supports.wxml
,.wxss(less|scss)
,.js
and.wxs
file.Install
```bash
npm i gulp-weapp-alias -D
```Usage
**gulpfile.js**
```js
const { src, dest } = require('gulp');
const aliases = require('gulp-weapp-alias');function aliasTask() {
return src('src/*.{wxss|less|scss|wxml|js}')
.pipe(aliases({
'@Aliases': "path/to/your/folder",
}))
.pipe(dest('dist'));
}
```the file before compilation
```js
// .js
import * as Utils from '@Aliases/utils/base';
require('@Aliases/utils/base')
```
```less
// .(wxss|less|scss)
@import '@Aliases/style/reset.less';.bg {
background-image: url('@Aliases/images/32821027.jpg');
}
```
```html
// .wxml```
will become:
```js
// .js
import * as Utils from 'path/to/your/folder/utils/base';
require('path/to/your/folder/utils/base')
```
```less
// .(wxss|less|scss)
@import 'path/to/your/folder/style/reset.less';.bg {
background-image: url('path/to/your/folder/images/32821027.jpg');
}
```
```html
// .wxml```