Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gulp-wechat-weapp-src-alisa with all npm packages installed. Try it out:

var gulpWechatWeappSrcAlisa = require("gulp-wechat-weapp-src-alisa")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gulp-wechat-weapp-src-alisa v1.0.2

Gulp plugin that lets you create custom aliases for wecaht weapp with an @alias rule.

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` and `.wxs` file.

Install

  npm i --save-dev gulp-wechat-weapp-src-alisa

Usage

gulpfile.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
<import src="@Aliases/wxs/index.wxs" />

<image src="@Aliases/images/32821027.jpg" mode="cover"></image>

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
<import src="path/to/your/folder/wxs/index.wxs" />

<image src="path/to/your/folder/images/32821027.jpg" mode="cover"></image>

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free