Socket
Book a DemoInstallSign in
Socket

@tinajs/gulp-mina

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinajs/gulp-mina

split/precompile mina single-file-component

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

gulp-mina

:oden: split/precompile mina single-file-component

npm license PRs Welcome

Install

npm install --save-dev @tinajs/gulp-mina

Usage

Precompile mina single-file-component library

const gulp = require('gulp')
const babel = require('gulp-babel')
const mina = require('@tinajs/gulp-mina')

gulp.task('default', () => {
  return gulp.src('src/**/*.mina')
    .pipe(mina({
      script: (stream) => stream.pipe(babel({ presets: ['env'] })),
    }))
    .pipe(gulp.dest('dist'))
})

Example (more complicated)

Split mina single-file-component to a group of files (wxml, wxss, json and js)

const gulp = require('gulp')
const babel = require('gulp-babel')
const mina = require('@tinajs/gulp-mina')
gulp.task('default', ['clean'], () => {
  return gulp.src('src/**/*.mina')
    .pipe(mina.split({
      script: (stream) => stream.pipe(babel({ presets: ['env'] })),
    }))
    .pipe(gulp.dest('dist'))
})

Example

API

mina([mapping])

Separate mina-sfc to multiple streams, and pipe the recombined results down.

mapping

Type: Object
Default: {}

Each separated streams of mina-sfc file will be passed to these mapping functions.

script

Type: Function

Receive the stream of <script> part as a .js file.

config

Type: Function

Receive the stream of <config> part as a .json file.

style

Type: Function

Receive the stream of <style> part as a .wxss file.

template

Type: Function

Receive the stream of <template> part as a .wxml file.

mina.split([mapping])

Just like mina([mapping]), but pipe separated mina-sfc as multiple files to the downstream.

  • gulp
  • mina-sfc

License

MIT © yelo, 2017 - present

FAQs

Package last updated on 15 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts