作者 Karson

新增JS、CSS控制台一键压缩功能

移除原有JS、CSS压缩方式
  1 +<?php
  2 +
  3 +namespace app\admin\command;
  4 +
  5 +use think\console\Command;
  6 +use think\console\Input;
  7 +use think\console\input\Option;
  8 +use think\console\Output;
  9 +use think\Exception;
  10 +
  11 +class Min extends Command
  12 +{
  13 +
  14 + /**
  15 + * 路径和文件名配置
  16 + */
  17 + protected $options = [
  18 + 'cssBaseUrl' => 'public/assets/css/',
  19 + 'cssBaseName' => '{module}',
  20 + 'jsBaseUrl' => 'public/assets/js/',
  21 + 'jsBaseName' => 'require-{module}',
  22 + ];
  23 +
  24 + protected function configure()
  25 + {
  26 + $this
  27 + ->setName('min')
  28 + ->addOption('module', 'm', Option::VALUE_REQUIRED, 'module name(frontend or backend),use \'all\' when build all modules', null)
  29 + ->addOption('resource', 'r', Option::VALUE_REQUIRED, 'resource name(js or css),use \'all\' when build all resources', null)
  30 + ->setDescription('Compress js and css file');
  31 + }
  32 +
  33 + protected function execute(Input $input, Output $output)
  34 + {
  35 + $module = $input->getOption('module') ? : '';
  36 + $resource = $input->getOption('resource') ? : '';
  37 +
  38 + if (!$module || !in_array($module, ['frontend', 'backend', 'all']))
  39 + {
  40 + throw new Exception('Please input correct module name');
  41 + }
  42 + if (!$resource || !in_array($resource, ['js', 'css', 'all']))
  43 + {
  44 + throw new Exception('Please input correct resource name');
  45 + }
  46 +
  47 + $moduleArr = $module == 'all' ? ['frontend', 'backend'] : [$module];
  48 + $resourceArr = $resource == 'all' ? ['js', 'css'] : [$resource];
  49 +
  50 + $minPath = __DIR__ . DS . 'Min' . DS;
  51 + $publicPath = ROOT_PATH . 'public' . DS;
  52 + $tempFile = $minPath . 'temp.js';
  53 +
  54 + try
  55 + {
  56 + $nodeExec = exec("which node");
  57 + if (!$nodeExec)
  58 + {
  59 + throw new Exception("node environment not found!please install node first!");
  60 + }
  61 + }
  62 + catch (Exception $e)
  63 + {
  64 + throw new Exception($e->getMessage());
  65 + }
  66 +
  67 + foreach ($moduleArr as $mod)
  68 + {
  69 + foreach ($resourceArr as $res)
  70 + {
  71 + $data = [
  72 + 'publicPath' => $publicPath,
  73 + 'jsBaseName' => str_replace('{module}', $mod, $this->options['jsBaseName']),
  74 + 'jsBaseUrl' => $this->options['jsBaseUrl'],
  75 + 'cssBaseName' => str_replace('{module}', $mod, $this->options['cssBaseName']),
  76 + 'cssBaseUrl' => $this->options['cssBaseUrl'],
  77 + 'jsBasePath' => ROOT_PATH . $this->options['jsBaseUrl'],
  78 + 'cssBasePath' => ROOT_PATH . $this->options['cssBaseUrl'],
  79 + 'ds' => DS,
  80 + ];
  81 +
  82 + //源文件
  83 + $from = $data["{$res}BasePath"] . $data["{$res}BaseName"] . '.' . $res;
  84 + if (!is_file($from))
  85 + {
  86 + $output->error("{$res} source file not found!file:{$from}");
  87 + continue;
  88 + }
  89 + if ($res == "js")
  90 + {
  91 + $content = file_get_contents($from);
  92 + preg_match("/require\.config\(\{[\n]+(.*?)\n\}\);/is", $content, $matches);
  93 + if (!isset($matches[1]))
  94 + {
  95 + $output->error("js config not found!");
  96 + continue;
  97 + }
  98 + $config = preg_replace("/(urlArgs|baseUrl):(.*)\n/", '', $matches[1]);
  99 + $data['config'] = $config;
  100 + }
  101 + // 生成压缩文件
  102 + $this->writeToFile($res, $data, $tempFile);
  103 +
  104 + $output->info("Compress " . $data["{$res}BaseName"] . ".{$res}");
  105 +
  106 + // 执行压缩
  107 + echo exec("{$nodeExec} {$minPath}r.js -o {$tempFile} >> {$minPath}node.log");
  108 + }
  109 + }
  110 +
  111 + @unlink($tempFile);
  112 +
  113 + $output->info("Build Successed!");
  114 + }
  115 +
  116 + /**
  117 + * 写入到文件
  118 + * @param string $name
  119 + * @param array $data
  120 + * @param string $pathname
  121 + * @return mixed
  122 + */
  123 + protected function writeToFile($name, $data, $pathname)
  124 + {
  125 + $search = $replace = [];
  126 + foreach ($data as $k => $v)
  127 + {
  128 + $search[] = "{%{$k}%}";
  129 + $replace[] = $v;
  130 + }
  131 + $stub = file_get_contents($this->getStub($name));
  132 + $content = str_replace($search, $replace, $stub);
  133 +
  134 + if (!is_dir(dirname($pathname)))
  135 + {
  136 + mkdir(strtolower(dirname($pathname)), 0755, true);
  137 + }
  138 + return file_put_contents($pathname, $content);
  139 + }
  140 +
  141 + /**
  142 + * 获取基础模板
  143 + * @param string $name
  144 + * @return string
  145 + */
  146 + protected function getStub($name)
  147 + {
  148 + return __DIR__ . '/Min/stubs/' . $name . '.stub';
  149 + }
  150 +
  151 +}
  1 +({
  2 + cssIn: "{%cssBasePath%}{%cssBaseName%}.css",
  3 + out: "{%cssBasePath%}{%cssBaseName%}.min.css",
  4 + optimizeCss: "default"
  5 +})
  1 +({
  2 + {%config%}
  3 + ,
  4 + optimizeCss: "standard",
  5 + optimize: "none",
  6 + removeCombined: false,
  7 + baseUrl: "{%jsBasePath%}", //JS文件所在的基础目录
  8 + name: "{%jsBaseName%}", //来源文件,不包含后缀
  9 + out: "{%jsBasePath%}{%jsBaseName%}.min.js" //目标文件
  10 +});
@@ -27,7 +27,7 @@ class Dashboard extends Backend @@ -27,7 +27,7 @@ class Dashboard extends Backend
27 $paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day])); 27 $paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day]));
28 } 28 }
29 $this->view->assign([ 29 $this->view->assign([
30 - 'totaluser' => 3500, 30 + 'totaluser' => 35200,
31 'totalviews' => 219390, 31 'totalviews' => 219390,
32 'totalorder' => 32143, 32 'totalorder' => 32143,
33 'totalorderamount' => 174800, 33 'totalorderamount' => 174800,
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 4
5 <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" /> 5 <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" />
6 <!-- Loading Bootstrap --> 6 <!-- Loading Bootstrap -->
7 -<link href="__CDN__/assets/{$Think.config.app_debug?'build/backend':'css/backend.min'}.css?v={$Think.config.site.version}" rel="stylesheet"> 7 +<link href="__CDN__/assets/css/backend{$Think.config.app_debug?'':'.min'}.css?v={$Think.config.site.version}" rel="stylesheet">
8 8
9 <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. --> 9 <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
10 <!--[if lt IE 9]> 10 <!--[if lt IE 9]>
@@ -14,4 +14,5 @@ return [ @@ -14,4 +14,5 @@ return [
14 'app\admin\command\Crud', 14 'app\admin\command\Crud',
15 'app\admin\command\Menu', 15 'app\admin\command\Menu',
16 'app\admin\command\Install', 16 'app\admin\command\Install',
  17 + 'app\admin\command\Min',
17 ]; 18 ];
1 <?php 1 <?php
2 2
  3 +namespace app\common\model;
  4 +
3 use think\Model; 5 use think\Model;
4 6
5 /** 7 /**
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <meta name="description" content="基于ThinkPHP5和Bootstrap的极速后台开发系统"> 7 <meta name="description" content="基于ThinkPHP5和Bootstrap的极速后台开发系统">
8 <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" /> 8 <link rel="shortcut icon" href="__CDN__/assets/img/favicon.ico" />
9 <!-- Loading Bootstrap --> 9 <!-- Loading Bootstrap -->
10 - <link href="__CDN__/assets/{$Think.config.app_debug?'build/frontend':'css/frontend.min'}.css?v={$Think.config.site.version}" rel="stylesheet"> 10 + <link href="__CDN__/assets/css/frontend{$Think.config.app_debug?'':'.min'}.css?v={$Think.config.site.version}" rel="stylesheet">
11 11
12 <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> 12 <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
13 <!--[if lt IE 9]> 13 <!--[if lt IE 9]>
1 -({  
2 - cssIn: 'backend.css',  
3 - out: '../css/backend.min.css',  
4 - optimizeCss: 'default'  
5 -})  
1 -({  
2 - baseUrl: '../js',  
3 - optimizeCss: 'standard',  
4 - optimize: 'none',  
5 - removeCombined: false,  
6 - name: "require-backend",  
7 - include: ['css', 'layer', 'toastr', 'backend', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs'],  
8 - out: "../js/require-backend.min.js",  
9 - packages: [{  
10 - name: 'moment',  
11 - location: '../libs/moment',  
12 - main: 'moment'  
13 - }],  
14 - paths: {  
15 - 'lang': "empty:",  
16 - 'config': 'require-config',  
17 - 'bootstrap-checkbox': 'bootstrap-checkbox',  
18 - 'bootstrap-radio': 'bootstrap-radio',  
19 - 'bootstrap-switch': 'bootstrap-switch',  
20 - 'form': 'require-form',  
21 - 'table': 'require-table',  
22 - 'upload': 'require-upload',  
23 - 'drag': 'jquery.drag.min',  
24 - 'drop': 'jquery.drop.min',  
25 - 'echarts-theme': 'echarts-theme',  
26 - 'adminlte': 'adminlte',  
27 - //  
28 - // 以下的包从bower的libs目录加载  
29 - 'jquery': '../libs/jquery/dist/jquery.min',  
30 - 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',  
31 - 'bootstrap-validator': '../libs/bootstrap-validator/dist/validator.min',  
32 - 'bootstrap-typeahead': '../libs/bootstrap3-typeahead/bootstrap3-typeahead.min',  
33 - 'bootstrap-tagsinput': '../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.min',  
34 - 'bootstrap-dialog': '../libs/bootstrap3-dialog/dist/js/bootstrap-dialog.min',  
35 - 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',  
36 - 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',  
37 - 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',  
38 - 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',  
39 - 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',  
40 - 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',  
41 - 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',  
42 - 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',  
43 - 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',  
44 - 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',  
45 - 'dropzone': '../libs/dropzone/dist/min/dropzone-amd-module.min',  
46 - 'less': '../libs/less/dist/less.min',  
47 - 'dragsort': '../libs/dragsort/jquery.dragsort',  
48 - 'sortable': '../libs/Sortable/Sortable.min',  
49 - 'addtabs': '../libs/jquery-addtabs/jquery.addtabs',  
50 - 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',  
51 - 'crontab': '../libs/jqcron/src/jqCron.cn',  
52 - 'summernote': '../libs/summernote/dist/lang/summernote-zh-CN.min',  
53 - 'validator': '../libs/nice-validator/dist/local/zh-CN',  
54 - 'plupload': '../libs/plupload/js/plupload.min',  
55 - 'toastr': '../libs/toastr/toastr',  
56 - 'jstree': '../libs/jstree/dist/jstree.min',  
57 - 'layer': '../libs/layer/src/layer',  
58 - 'echarts': '../libs/echarts/dist/echarts.min',  
59 - 'cookie': '../libs/jquery.cookie/jquery.cookie',  
60 - 'template': '../libs/art-template/dist/template-native',  
61 - },  
62 - // shim依赖配置  
63 - shim: {  
64 - 'bootstrap': ['jquery'],  
65 - 'bootstrap-table': {  
66 - deps: ['bootstrap', 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'],  
67 - exports: '$.fn.bootstrapTable'  
68 - },  
69 - 'bootstrap-table-lang': {  
70 - deps: ['bootstrap-table'],  
71 - exports: '$.fn.bootstrapTable.defaults'  
72 - },  
73 - 'bootstrap-table-export': {  
74 - deps: ['bootstrap-table', 'tableexport'],  
75 - exports: '$.fn.bootstrapTable.defaults'  
76 - },  
77 - 'bootstrap-table-mobile': {  
78 - deps: ['bootstrap-table'],  
79 - exports: '$.fn.bootstrapTable.defaults'  
80 - },  
81 - 'bootstrap-table-advancedsearch': {  
82 - deps: ['bootstrap-table'],  
83 - exports: '$.fn.bootstrapTable.defaults'  
84 - },  
85 - 'tableexport': {  
86 - deps: ['jquery'],  
87 - exports: '$.fn.extend'  
88 - },  
89 - 'slimscroll': {  
90 - deps: ['jquery'],  
91 - exports: '$.fn.extend'  
92 - },  
93 - 'adminlte': {  
94 - deps: ['bootstrap', 'slimscroll'],  
95 - exports: '$.AdminLTE'  
96 - },  
97 - 'typeahead': {  
98 - deps: ['jquery'],  
99 - init: function ($) {  
100 - return require.s.contexts._.registry['typeahead.js'].factory($);  
101 - }  
102 - },  
103 - 'crontab': ['../libs/jqcron/src/jqCron', 'css!../libs/jqcron/src/jqCron.css'],  
104 - 'bootstrap-checkbox': ['jquery'],  
105 - 'bootstrap-radio': ['jquery'],  
106 - 'bootstrap-switch': ['jquery'],  
107 - 'bootstrap-dialog': ['css!../libs/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css'],  
108 - 'bootstrap-datetimepicker': [  
109 - 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',  
110 - 'moment/locale/zh-cn'  
111 - ],  
112 - 'bootstrap-tagsinput': [  
113 - 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css',  
114 - 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.css',  
115 - 'jquery',  
116 - 'typeahead'  
117 - ],  
118 - 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],  
119 - 'summernote': ['../libs/summernote/dist/summernote.min', 'css!../libs/summernote/dist/summernote.css'],  
120 -// 'toastr': ['css!../libs/toastr/toastr.min.css'],  
121 - 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],  
122 - 'plupload': {  
123 - deps: [  
124 - '../libs/plupload/js/moxie.min'  
125 - ],  
126 - exports: "plupload"  
127 - },  
128 -// 'layer': ['css!../libs/layer/build/skin/default/layer.css'],  
129 - validator: {  
130 - deps: ['../libs/nice-validator/dist/jquery.validator', 'css!../libs/nice-validator/dist/jquery.validator.css']  
131 - }  
132 - },  
133 - map: {  
134 - '*': {  
135 - 'css': '../libs/require-css/css.min'  
136 - }  
137 - },  
138 - charset: 'utf-8' // 文件编码  
139 -});  
1 -({  
2 - cssIn: 'frontend.css',  
3 - out: '../css/frontend.min.css',  
4 - optimizeCss: 'default'  
5 -})  
1 -({  
2 - baseUrl: '../js',  
3 - optimizeCss: 'standard',  
4 - optimize: 'none',  
5 - removeCombined: false,  
6 - name: "require-frontend",  
7 - include: ['css', 'layer', 'toastr', 'frontend'],  
8 - out: "../js/require-frontend.min.js",  
9 - packages: [{  
10 - name: 'moment',  
11 - location: '../libs/moment',  
12 - main: 'moment'  
13 - }],  
14 - paths: {  
15 - 'lang': "empty:",  
16 - 'config': 'require-config',  
17 - 'bootstrap-checkbox': 'bootstrap-checkbox',  
18 - 'bootstrap-radio': 'bootstrap-radio',  
19 - 'bootstrap-switch': 'bootstrap-switch',  
20 - 'form': 'require-form',  
21 - 'table': 'require-table',  
22 - 'upload': 'require-upload',  
23 - 'drag': 'jquery.drag.min',  
24 - 'drop': 'jquery.drop.min',  
25 - 'echarts-theme': 'echarts-theme',  
26 - 'adminlte': 'adminlte',  
27 - //  
28 - // 以下的包从bower的libs目录加载  
29 - 'jquery': '../libs/jquery/dist/jquery.min',  
30 - 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',  
31 - 'bootstrap-validator': '../libs/bootstrap-validator/dist/validator.min',  
32 - 'bootstrap-typeahead': '../libs/bootstrap3-typeahead/bootstrap3-typeahead.min',  
33 - 'bootstrap-tagsinput': '../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.min',  
34 - 'bootstrap-dialog': '../libs/bootstrap3-dialog/dist/js/bootstrap-dialog.min',  
35 - 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',  
36 - 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',  
37 - 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',  
38 - 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',  
39 - 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',  
40 - 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',  
41 - 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',  
42 - 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',  
43 - 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',  
44 - 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',  
45 - 'dropzone': '../libs/dropzone/dist/min/dropzone-amd-module.min',  
46 - 'less': '../libs/less/dist/less.min',  
47 - 'dragsort': '../libs/dragsort/jquery.dragsort',  
48 - 'sortable': '../libs/Sortable/Sortable.min',  
49 - 'addtabs': '../libs/jquery-addtabs/jquery.addtabs',  
50 - 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',  
51 - 'crontab': '../libs/jqcron/src/jqCron.cn',  
52 - 'summernote': '../libs/summernote/dist/lang/summernote-zh-CN.min',  
53 - 'validator': '../libs/nice-validator/dist/local/zh-CN',  
54 - 'plupload': '../libs/plupload/js/plupload.min',  
55 - 'toastr': '../libs/toastr/toastr',  
56 - 'jstree': '../libs/jstree/dist/jstree.min',  
57 - 'layer': '../libs/layer/src/layer',  
58 - 'echarts': '../libs/echarts/dist/echarts.min',  
59 - 'cookie': '../libs/jquery.cookie/jquery.cookie',  
60 - 'template': '../libs/art-template/dist/template-native',  
61 - },  
62 - // shim依赖配置  
63 - shim: {  
64 - 'bootstrap': ['jquery'],  
65 - 'bootstrap-table': {  
66 - deps: ['bootstrap', 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'],  
67 - exports: '$.fn.bootstrapTable'  
68 - },  
69 - 'bootstrap-table-lang': {  
70 - deps: ['bootstrap-table'],  
71 - exports: '$.fn.bootstrapTable.defaults'  
72 - },  
73 - 'bootstrap-table-export': {  
74 - deps: ['bootstrap-table', 'tableexport'],  
75 - exports: '$.fn.bootstrapTable.defaults'  
76 - },  
77 - 'bootstrap-table-mobile': {  
78 - deps: ['bootstrap-table'],  
79 - exports: '$.fn.bootstrapTable.defaults'  
80 - },  
81 - 'bootstrap-table-advancedsearch': {  
82 - deps: ['bootstrap-table'],  
83 - exports: '$.fn.bootstrapTable.defaults'  
84 - },  
85 - 'tableexport': {  
86 - deps: ['jquery'],  
87 - exports: '$.fn.extend'  
88 - },  
89 - 'slimscroll': {  
90 - deps: ['jquery'],  
91 - exports: '$.fn.extend'  
92 - },  
93 - 'adminlte': {  
94 - deps: ['bootstrap', 'slimscroll'],  
95 - exports: '$.AdminLTE'  
96 - },  
97 - 'typeahead': {  
98 - deps: ['jquery'],  
99 - init: function ($) {  
100 - return require.s.contexts._.registry['typeahead.js'].factory($);  
101 - }  
102 - },  
103 - 'crontab': ['../libs/jqcron/src/jqCron', 'css!../libs/jqcron/src/jqCron.css'],  
104 - 'bootstrap-checkbox': ['jquery'],  
105 - 'bootstrap-radio': ['jquery'],  
106 - 'bootstrap-switch': ['jquery'],  
107 - 'bootstrap-dialog': ['css!../libs/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css'],  
108 - 'bootstrap-datetimepicker': [  
109 - 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',  
110 - 'moment/locale/zh-cn'  
111 - ],  
112 - 'bootstrap-tagsinput': [  
113 - 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css',  
114 - 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.css',  
115 - 'jquery',  
116 - 'typeahead'  
117 - ],  
118 - 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],  
119 - 'summernote': ['../libs/summernote/dist/summernote.min', 'css!../libs/summernote/dist/summernote.css'],  
120 -// 'toastr': ['css!../libs/toastr/toastr.min.css'],  
121 - 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],  
122 - 'plupload': {  
123 - deps: [  
124 - '../libs/plupload/js/moxie.min'  
125 - ],  
126 - exports: "plupload"  
127 - },  
128 -// 'layer': ['css!../libs/layer/build/skin/default/layer.css'],  
129 - validator: {  
130 - deps: ['../libs/nice-validator/dist/jquery.validator', 'css!../libs/nice-validator/dist/jquery.validator.css']  
131 - }  
132 - },  
133 - map: {  
134 - '*': {  
135 - 'css': '../libs/require-css/css.min'  
136 - }  
137 - },  
138 - charset: 'utf-8' // 文件编码  
139 -});  
1 -#! /bin/bash  
2 -node r.js -o build-frontend.js  
3 -node r.js -o build-frontend-css.js  
4 -node r.js -o build-backend.js  
5 -node r.js -o build-backend-css.js  
6 -echo "done"  
@@ -5,7 +5,10 @@ require.config({ @@ -5,7 +5,10 @@ require.config({
5 location: '../libs/moment', 5 location: '../libs/moment',
6 main: 'moment' 6 main: 'moment'
7 }], 7 }],
  8 + //在打包压缩时将会把include中的模块合并到主文件中
  9 + include: ['css', 'layer', 'toastr', 'backend', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs'],
8 paths: { 10 paths: {
  11 + 'lang': "empty:",
9 'config': 'require-config', 12 'config': 'require-config',
10 'bootstrap-checkbox': 'bootstrap-checkbox', 13 'bootstrap-checkbox': 'bootstrap-checkbox',
11 'bootstrap-radio': 'bootstrap-radio', 14 'bootstrap-radio': 'bootstrap-radio',
@@ -22,7 +22,10 @@ require.config({ @@ -22,7 +22,10 @@ require.config({
22 location: '../libs/moment', 22 location: '../libs/moment',
23 main: 'moment' 23 main: 'moment'
24 }], 24 }],
  25 + //在打包压缩时将会把include中的模块合并到主文件中
  26 + include: ['css', 'layer', 'toastr', 'backend', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs'],
25 paths: { 27 paths: {
  28 + 'lang': "empty:",
26 'config': 'require-config', 29 'config': 'require-config',
27 'bootstrap-checkbox': 'bootstrap-checkbox', 30 'bootstrap-checkbox': 'bootstrap-checkbox',
28 'bootstrap-radio': 'bootstrap-radio', 31 'bootstrap-radio': 'bootstrap-radio',
@@ -5,7 +5,10 @@ require.config({ @@ -5,7 +5,10 @@ require.config({
5 location: '../libs/moment', 5 location: '../libs/moment',
6 main: 'moment' 6 main: 'moment'
7 }], 7 }],
  8 + //在打包压缩时将会把include中的模块合并到主文件中
  9 + include: ['css', 'layer', 'toastr', 'frontend'],
8 paths: { 10 paths: {
  11 + 'lang': "empty:",
9 'config': 'require-config', 12 'config': 'require-config',
10 'bootstrap-checkbox': 'bootstrap-checkbox', 13 'bootstrap-checkbox': 'bootstrap-checkbox',
11 'bootstrap-radio': 'bootstrap-radio', 14 'bootstrap-radio': 'bootstrap-radio',
@@ -22,7 +22,10 @@ require.config({ @@ -22,7 +22,10 @@ require.config({
22 location: '../libs/moment', 22 location: '../libs/moment',
23 main: 'moment' 23 main: 'moment'
24 }], 24 }],
  25 + //在打包压缩时将会把include中的模块合并到主文件中
  26 + include: ['css', 'layer', 'toastr', 'frontend'],
25 paths: { 27 paths: {
  28 + 'lang': "empty:",
26 'config': 'require-config', 29 'config': 'require-config',
27 'bootstrap-checkbox': 'bootstrap-checkbox', 30 'bootstrap-checkbox': 'bootstrap-checkbox',
28 'bootstrap-radio': 'bootstrap-radio', 31 'bootstrap-radio': 'bootstrap-radio',