hm-gismap-gulp
汉图研发部gis前端开发打包工具
Last updated 8 months ago by lulee007 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hm-gismap-gulp 
SYNC missed versions from official npm registry.

gulp-hm-web-gis-tool

汉图研发部gis前端开发打包工具

安装:

npm i hm-gismap-gulp

配置:

  1. 在项目根目录添加 gulp 文件夹,然后添加配置文件 config.js:

    'use strict';
    var process = require('process');
    var cwd = process.cwd();
    
    module.exports = {
        dist: 'src/main/dist/',
        webappDir: 'src/main/webapp/',
        revDest: 'src/main/tmp/',
        bower: 'src/main/webapp/bower_components/',
        tmp: 'src/main/tmp/',
        revManifest: 'src/main/tmp/rev-manifest.json',
        webTargetDir: 'target/',
        port: 9000,
        gulpDir: cwd + '/gulp/',
        projectName : 'sims-xxxxx'
    };
    
    
  2. 添加 gulpfile.js

    'use strict';
    var gulp = require('gulp');
    
    
    var tool = require('hm-gismap-gulp'),
        config = require('./gulp/config');
    // 一定要添加配置文件
    tool.configWrap.config = config;
    
    gulp.task('build', tool.build);
    
    gulp.task('default',['build'], tool.watch);
    
  3. 在 gulp 目录中添加项目文件 project-xxx.js:

    'use strict';
    
    module.exports = {
        venderCss: [
            // 第三方库 css 文件
        ],
        venderJs: [
            // 第三方库 js 文件
        ],
        venderAssets: [
            // 可能需要的第三方库额外文件
        ]
    };
    
    

使用方式:

  • 打包:

    gulp build --pages=page1,page2
    
  • 开发调试

    # port 为 tomcat 端口号
    gulp --port=8080 --pages=page1,page2
    

    然后运行 tomcat 即可。

旧版本打包

gulpfile.js 文件内容:

gulp.task('clean-state', function () {
    var targetJs = 'app.other.state.js';
    return gulp.src(config.app + '/app/' + targetJs)
        .pipe(clean());
});

/**
 * 将所有state文件合并到 all.other.state.js 文件当中
 **/
gulp.task('build:routers', ['clean-state'], function () {
    var targetJs = 'app.other.state.js';
    return gulp.src([config.app + 'app/**/!(app)*.state.js'])
        .pipe(concat(targetJs))
        .pipe(gulp.dest(config.app + '/app/'));
});

gulp.task('watch:routers', function () {
    gulp.watch(config.app + 'app/**/!(app)*.state.js', ['build:routers']);
});

gulp.task('browser-sync', function () {

    browserSync({
        open: true,
        port: config.port,
        // proxy: "http://192.168.8.34:18080",
        server: {
            baseDir: config.app
        }
        // serveStatic: [config.app]
    });
    gulp.watch([config.app + '*.html', config.app + 'app/**']).on('change', browserSync.reload);

});

gulp.task('default', function (cb) {
    runSequence(['build:routers', 'watch:routers', 'browser-sync'],cb);
});

Current Tags

  • 1.0.8                                ...           latest (8 months ago)

7 Versions

  • 1.0.8                                ...           8 months ago
  • 1.0.6                                ...           9 months ago
  • 1.0.5                                ...           9 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 0
Last Month 9
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |