Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maelweb/gulp-wechat-weapp-src-alisa
Gulp plugin that lets you create custom aliases for wecaht weapp with an @alias rule.
https://github.com/maelweb/gulp-wechat-weapp-src-alisa
Last synced: 2 days ago
JSON representation
Gulp plugin that lets you create custom aliases for wecaht weapp with an @alias rule.
- Host: GitHub
- URL: https://github.com/maelweb/gulp-wechat-weapp-src-alisa
- Owner: MaelWeb
- License: mit
- Created: 2019-02-19T10:09:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-10T08:57:05.000Z (over 1 year ago)
- Last Synced: 2024-10-31T17:59:43.703Z (14 days ago)
- Language: JavaScript
- Size: 49.8 KB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Gulp Wechat Weapp Src Alisa
Gulp plugin that lets you create custom aliases for wecaht weapp with an @alias rule. Supports `.wxml`, `.wxss(less|scss)`, `.js(`ts|wxs`)` and `.json` file.
Install
```bash
npm i --save-dev gulp-wechat-weapp-src-alisa
```Usage
**gulpfile.js**
```js
const { src, dest } = require('gulp');
const aliases = require('gulp-wechat-weapp-src-alisa');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
import * as Utils from '@Aliases/utils/base';
require('@Aliases/utils/base')// .(wxss|less|scss)
@import '@Aliases/style/reset.less';.bg {
background-image: url('@Aliases/images/32821027.jpg');
}// .wxml
```
will become:
```
// .js
import * as Utils from 'path/to/your/folder/utils/base';
require('path/to/your/folder/utils/base')// .(wxss|less|scss)
@import 'path/to/your/folder/style/reset.less';.bg {
background-image: url('path/to/your/folder/images/32821027.jpg');
}// .wxml
```