1.7.2 • Published 8 years ago

gulp-mm v1.7.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

##wechat web rebuild team dev tool

###about us http://mmrb.github.io

###installation

npm install -g gulp
npm install --save-dev gulp gulp-mm

###usage

create gulpfile.js

var gulp = require('gulp');
var mm = require('gulp-mm');

gulp.task('build', function(){
    mm.watch('./src/**/*.less')
      .pipe(mm.less())
      .pipe(mm.sprite())
      .pipe(gulp.dest('./preview'))
      .pipe(mm.uglify())
      .pipe(gulp.dest('./dist'));
      
    mm.watch('./src/**/*.html')
      .pipe(mm.inline())
      .pipe(mm.optimization())
      .pipe(gulp.dest('./preview'))
      .pipe(mm.resolve())
      .pipe('./dist');
});

gulp.task('server', function(){
    mm.server.start({root: __dirname + '/preview'});
});

gulp.task('default', ['build', 'server']);

###api

server

express + socket.io(for live reload)

mm.server.start({root: __dirname + '/preview'});

// when file change
mm.server.emit('change');

inline

you can import other file in your html, or javascript file with inline plugin, for example:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>sprite</title>
    <!-- output: <style>content of style.less(after compile to css) </style> -->
    <link rel="stylesheet" href="./style.less?__inline"/>
</head>
<body>
    <!-- output: <img src="base64 of hello.png" -->
    <img src="hello.png?__inline"/>

    <!-- output: content of fragment -->
    <link rel="import" href="./fragment.html?__inline"/>
</body>
</html>
// it will be replaced with content of zepto.js here
__inline("../lib/zepto.js");

$(function(){
    console.log('hello world!');
});
.icon_new{
    display: inline-block;
    width: 16px;
    height: 16px;
    /* background's image will be replaced with icon's base64 format*/
    background: url("../images/icon/new.png?__inline");
}

sprite

the icon images will be concat to one image, which is named as current css file plus '_z.png', for example: icon_z.png.

/* icon.css */

.icon_new{
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    /* here will be replace sprite image path, and auto set the background-position */
    background: url("../images/icon/new.png?__sprite");
}

.icon_add{
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    background: url("../images/icon/add.png?__sprite");
}

.icon_search{
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    /* here will be replace @2x sprite image path, and auto set the background-position and background-size*/
    /* for ratina */
    background: url("../images/icon/add@2x.png?__sprite");
}
1.7.2

8 years ago

1.7.0

10 years ago

1.6.7

10 years ago

1.6.6

10 years ago

1.6.5

10 years ago

1.6.4

10 years ago

1.6.3

10 years ago

1.6.2

10 years ago

1.6.1

10 years ago

1.6.0

10 years ago

1.5.8

10 years ago

1.5.6

10 years ago

1.5.4

10 years ago

1.5.3

10 years ago

1.5.1

10 years ago

1.5.0

10 years ago

1.4.7

10 years ago

1.4.6

10 years ago

1.4.5

10 years ago

1.4.4

10 years ago

1.4.3

10 years ago

1.4.2

10 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.7

10 years ago

1.3.6

10 years ago

1.3.5

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.35

10 years ago

0.0.34

10 years ago

0.0.33

10 years ago

0.0.32

10 years ago

0.0.31

10 years ago

0.0.30

10 years ago

0.0.29

10 years ago

0.0.28

10 years ago

0.0.27

10 years ago

0.0.26

10 years ago

0.0.25

10 years ago

0.0.24

10 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

11 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago