mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Make red.min.js a reusable library
This commit is contained in:
parent
3489fe0cf4
commit
1c3a97a71a
22
Gruntfile.js
22
Gruntfile.js
@ -98,7 +98,7 @@ module.exports = function(grunt) {
|
|||||||
src: [
|
src: [
|
||||||
// Ensure editor source files are concatenated in
|
// Ensure editor source files are concatenated in
|
||||||
// the right order
|
// the right order
|
||||||
"editor/js/main.js",
|
"editor/js/red.js",
|
||||||
"editor/js/events.js",
|
"editor/js/events.js",
|
||||||
"editor/js/i18n.js",
|
"editor/js/i18n.js",
|
||||||
"editor/js/settings.js",
|
"editor/js/settings.js",
|
||||||
@ -150,11 +150,6 @@ module.exports = function(grunt) {
|
|||||||
"public/vendor/vendor.css": [
|
"public/vendor/vendor.css": [
|
||||||
// TODO: resolve relative resource paths in
|
// TODO: resolve relative resource paths in
|
||||||
// bootstrap/FA/jquery
|
// bootstrap/FA/jquery
|
||||||
],
|
|
||||||
"public/vendor/vendor-jquery.js": [
|
|
||||||
"editor/vendor/jquery/js/jquery-1.11.3.min.js",
|
|
||||||
"editor/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js",
|
|
||||||
"editor/vendor/jquery/js/jquery.ui.touch-punch.min.js",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +157,8 @@ module.exports = function(grunt) {
|
|||||||
uglify: {
|
uglify: {
|
||||||
build: {
|
build: {
|
||||||
files: {
|
files: {
|
||||||
'public/red/red.min.js': 'public/red/red.js'
|
'public/red/red.min.js': 'public/red/red.js',
|
||||||
|
'public/red/main.min.js': 'public/red/main.js'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -193,7 +189,8 @@ module.exports = function(grunt) {
|
|||||||
attachCopyright: {
|
attachCopyright: {
|
||||||
js: {
|
js: {
|
||||||
src: [
|
src: [
|
||||||
'public/red/red.min.js'
|
'public/red/red.min.js',
|
||||||
|
'public/red/main.min.js'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
@ -272,7 +269,12 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
copy: {
|
copy: {
|
||||||
build: {
|
build: {
|
||||||
files:[{
|
files:[
|
||||||
|
{
|
||||||
|
src: 'editor/js/main.js',
|
||||||
|
dest: 'public/red/main.js'
|
||||||
|
},
|
||||||
|
{
|
||||||
cwd: 'editor/images',
|
cwd: 'editor/images',
|
||||||
src: '**',
|
src: '**',
|
||||||
expand: true,
|
expand: true,
|
||||||
@ -431,7 +433,7 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
grunt.registerTask('build',
|
grunt.registerTask('build',
|
||||||
'Builds editor content',
|
'Builds editor content',
|
||||||
['clean:build','concat:build','concat:vendor','uglify:build','sass:build','jsonlint:messages','copy:build','attachCopyright']);
|
['clean:build','concat:build','concat:vendor','copy:build','uglify:build','sass:build','jsonlint:messages','attachCopyright']);
|
||||||
|
|
||||||
grunt.registerTask('dev',
|
grunt.registerTask('dev',
|
||||||
'Developer mode: run node-red, watch for source changes and build/restart',
|
'Developer mode: run node-red, watch for source changes and build/restart',
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
var RED = (function() {
|
(function() {
|
||||||
|
|
||||||
|
|
||||||
function loadNodeList() {
|
function loadNodeList() {
|
||||||
@ -261,8 +261,4 @@ var RED = (function() {
|
|||||||
RED.settings.init(loadEditor);
|
RED.settings.init(loadEditor);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
16
editor/js/red.js
Normal file
16
editor/js/red.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2013, 2016 IBM Corp.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
var RED = {};
|
@ -163,6 +163,7 @@
|
|||||||
<script src="vendor/ace/ace.js"></script>
|
<script src="vendor/ace/ace.js"></script>
|
||||||
<script src="vendor/ace/ext-language_tools.js"></script>
|
<script src="vendor/ace/ext-language_tools.js"></script>
|
||||||
<script src="{{ asset.red }}"></script>
|
<script src="{{ asset.red }}"></script>
|
||||||
|
<script src="{{ asset.main }}"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -31,7 +31,9 @@ var defaultContext = {
|
|||||||
image: "red/images/node-red.png"
|
image: "red/images/node-red.png"
|
||||||
},
|
},
|
||||||
asset: {
|
asset: {
|
||||||
red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js"
|
red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js",
|
||||||
|
main: (process.env.NODE_ENV == "development")? "red/main.js":"red/main.min.js",
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user