123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- var path = require('path');
- module.exports = function(grunt) {
- require('load-grunt-tasks')(grunt);
- /**
- * Resolve external project resource as file path
- */
- function resolvePath(project, file) {
- return path.join(path.dirname(require.resolve(project)), file);
- }
- grunt.initConfig({
- browserify: {
- options: {
- browserifyOptions: {
- debug: true
- },
- transform: [
- [ 'stringify', {
- extensions: [ '.bpmn' ]
- } ]
- ],
- plugin: [
- 'esmify'
- ]
- },
- watch: {
- options: {
- watch: true
- },
- files: {
- 'dist/index.js': [ 'app/**/*.js' ]
- }
- },
- app: {
- files: {
- 'dist/index.js': [ 'app/**/*.js' ]
- }
- }
- },
- copy: {
- diagram_js: {
- files: [
- {
- src: resolvePath('diagram-js', 'assets/diagram-js.css'),
- dest: 'dist/css/diagram-js.css'
- }
- ]
- },
- bpmn_js: {
- files: [
- {
- expand: true,
- cwd: resolvePath('bpmn-js', 'dist/assets'),
- src: ['**/*.*', '!**/*.js'],
- dest: 'dist/vendor'
- }
- ]
- },
- app: {
- files: [
- {
- expand: true,
- cwd: 'app/',
- src: ['**/*.*', '!**/*.js'],
- dest: 'dist'
- }
- ]
- }
- },
- less: {
- options: {
- dumpLineNumbers: 'comments',
- paths: [
- 'node_modules'
- ]
- },
- styles: {
- files: {
- 'dist/css/app.css': 'styles/app.less'
- }
- }
- },
- watch: {
- options: {
- livereload: true
- },
- samples: {
- files: [ 'app/**/*.*' ],
- tasks: [ 'copy:app' ]
- },
- less: {
- files: [
- 'styles/**/*.less',
- 'node_modules/bpmn-js-properties-panel/styles/**/*.less'
- ],
- tasks: [
- 'less'
- ]
- },
- },
- connect: {
- livereload: {
- options: {
- port: 9013,
- livereload: true,
- hostname: 'localhost',
- open: true,
- base: [
- 'dist'
- ]
- }
- }
- }
- });
- // tasks
- grunt.registerTask('build', [ 'copy', 'less', 'browserify:app' ]);
- grunt.registerTask('auto-build', [
- 'copy',
- 'less',
- 'browserify:watch',
- 'connect:livereload',
- 'watch'
- ]);
- grunt.registerTask('default', [ 'build' ]);
- };
|