lemo-crm/web/ember-cli-build.js
2022-06-18 16:05:31 +08:00

153 lines
6.1 KiB
JavaScript

'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const glob = require('glob')
module.exports = function(defaults) {
const app = new EmberApp(defaults, {
overwrite: true,
SRI: {
enabled: false
},
sourcemaps: {
enabled: EmberApp.env() !== 'production',
extensions: ['js', 'coffee']
},
outputPaths: {
app: {
html: 'index.html',
css: {
app: '/assets/css/main.css'
},
js: '/assets/js/main.js'
},
// only emberjs core
vendor: {
css: '/assets/css/emberjs.css',
js: '/assets/js/emberjs.js'
}
}
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
function importVendor(app, resource, outputFile) {
if (/\.js$/.test(resource)) {
app.import(resource, { outputFile: outputFile || 'assets/js/vendor.js'});
}
else if (/\.css$/.test(resource)) {
app.import(resource, { outputFile: outputFile || 'assets/css/vendor.css'});
}
}
importVendor(app, 'node_modules/bootstrap/dist/css/bootstrap.css');
// importVendor(app, 'node_modules/bootstrap/dist/css/bootstrap-theme.css');
importVendor(app, 'node_modules/bootstrap/dist/js/bootstrap.js');
glob.sync('node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.*', {})
.forEach(file => app.import(file, { destDir: 'assets/fonts' }));
importVendor(app, 'node_modules/json-format-highlight/dist/json-format-highlight.js');
// font awesome
importVendor(app, 'node_modules/font-awesome/css/font-awesome.min.css');
glob.sync('node_modules/font-awesome/fonts/*.*', {})
.forEach(file => app.import(file, { destDir: 'assets/fonts' }));
// Toastr
importVendor(app, 'node_modules/toastr/build/toastr.min.js');
importVendor(app, 'node_modules/toastr/build/toastr.min.css');
// Tags
importVendor(app, 'node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.js');
importVendor(app, 'node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.css');
importVendor(app, 'node_modules/bootbox/src/bootbox.js');
importVendor(app, 'node_modules/validate.js/validate.js');
// FueUX
importVendor(app, 'node_modules/fuelux/js/spinbox.js');
// for colorpicker
importVendor(app, 'node_modules/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css');
importVendor(app, 'node_modules/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js');
glob.sync('node_modules/bootstrap-colorpicker/dist/img/bootstrap-colorpicker/*.*', {})
.forEach(file => app.import(file, { destDir: 'assets/img/bootstrap-colorpicker' }));
// for image previews
importVendor(app, 'node_modules/jquery-colorbox/jquery.colorbox-min.js');
importVendor(app, 'node_modules/jquery-colorbox/example1/colorbox.css');
glob.sync('node_modules/jquery-colorbox/example1/images/*.*', {})
.forEach(file => app.import(file, { destDir: 'assets/css/images' }));
// ACE CSS
// JQuery UI
importVendor(app, 'vendor/ace/css/jquery-ui.custom.css');
importVendor(app, 'vendor/ace/js/jquery-ui.custom.js');
// Datetime picker
importVendor(app, 'vendor/ace/css/datepicker.css');
importVendor(app, 'vendor/ace/js/date-time/bootstrap-datepicker.js');
importVendor(app, 'vendor/ace/css/bootstrap-datetimepicker.css');
importVendor(app, 'vendor/ace/js/date-time/bootstrap-datetimepicker.js');
// Dual listbox
importVendor(app, 'vendor/ace/css/bootstrap-duallistbox.css');
importVendor(app, 'vendor/ace/js/jquery.bootstrap-duallistbox.js');
// Select 2
importVendor(app, 'node_modules/select2/dist/css/select2.css');
importVendor(app, 'node_modules/select2/dist/js/select2.js');
// Bootstrap WYSIWYG
importVendor(app, 'node_modules/bootstrap-wysiwyg/css/style.css');
importVendor(app, 'node_modules/bootstrap-wysiwyg/src/bootstrap-wysiwyg.js');
// WebSocket
importVendor(app, 'node_modules/@stomp/stompjs/bundles/stomp.umd.js');
importVendor(app, 'node_modules/sockjs-client/dist/sockjs.js');
// importVendor(app, 'node_modules/stomp-websocket/lib/stomp.js');
// Bootstrap Toolkit
importVendor(app, 'node_modules/responsive-toolkit/dist/bootstrap-toolkit.js');
// ACE CSS
importVendor(app, 'vendor/ace/css/ace.css');
importVendor(app, 'vendor/ace/css/ace-fonts.css');
app.import('vendor/ace/fonts/OpenSans-300.woff', { destDir: 'assets/fonts' })
app.import('vendor/ace/fonts/OpenSans-400.woff', { destDir: 'assets/fonts' })
glob.sync('vendor/ace/css/images/*.*', { })
.forEach(file => app.import(file, { destDir: 'assets/css/images' }));
// ACE JS
// start up
importVendor(app, 'vendor/ace/js/ace/ace.js');
importVendor(app, 'vendor/ace/js/ace-extra.js');
importVendor(app, 'vendor/ace/js/ace-elements.js');
importVendor(app, 'vendor/ace/js/ace/ace.touch-drag.js');
importVendor(app, 'vendor/ace/js/ace/ace.sidebar.js');
importVendor(app, 'vendor/ace/js/ace/ace.sidebar-scroll-1.js');
importVendor(app, 'vendor/ace/js/ace/ace.submenu-hover.js');
importVendor(app, 'vendor/ace/js/ace/ace.widget-box.js');
importVendor(app, 'vendor/ace/js/ace/ace.widget-on-reload.js');
importVendor(app, 'vendor/ace/js/ace/ace.searchbox-autocomplete.js');
// JQuery PubSub
importVendor(app, 'vendor/jquery-pubsub/js/jquery.pubsub.js');
// Audio Player
// importVendor(app, 'vendor/audioplayer/audioplayer.css');
// importVendor(app, 'vendor/audioplayer/audioplayer.js');
return app.toTree();
};