Skip to content

Commit 241ed84

Browse files
committed
JS Build optimizations: changed r.js - now use amd optimizer
1 parent a6768dc commit 241ed84

File tree

10 files changed

+281
-174
lines changed

10 files changed

+281
-174
lines changed

gulpfile.js

+251-126
Large diffs are not rendered by default.

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
{
22
"private": true,
3-
"devDependencies": {
4-
},
3+
"devDependencies": {},
54
"dependencies": {
65
"laravel-elixir": "^2.0.0",
7-
"gulp": "^3.8.8",
86
"gulp-uglify": "~1.4.0",
97
"run-sequence": "~1.1.2",
108
"gulp-concat": "~2.6.0",
11-
"through2": "~2.0.0",
129
"path": "~0.11.14",
1310
"event-stream": "~3.3.1",
1411
"fs": "0.0.2",
1512
"object-assign": "~4.0.1",
16-
"gulp-clean": "~0.3.1",
1713
"gulp-util": "~3.0.6",
18-
"requirejs": "~2.1.20"
14+
"amd-optimize": "~0.6.0",
15+
"del": "~2.0.2",
16+
"gulp": "~3.9.0",
17+
"gulp-tmpl": "0.0.3",
18+
"gulp-declare": "~0.3.0",
19+
"gulp-wrap-amd": "~0.5.0"
1920
}
2021
}

public/js/app.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ define([
22
'marionette',
33
'backbone',
44
'bootstrap',
5+
'underscore',
6+
'tpl',
57
'validation-model',
68
'jquery.scroll',
7-
'paginator',
8-
'updown'
9+
'paginator'
910
], function (Marionette, Backbone) {
1011
var App = new Marionette.Application();
1112
App.queryFlag = [];

public/js/require-main.js

+6-29
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ requirejs.config({
99
},
1010
paths: {
1111
backbone: 'vendor/backbone/backbone',
12-
'backbone.syphon': 'vendor/backbone/backbone.syphon',
1312
jquery: 'vendor/jquery/jquery',
1413
'jquery.scroll': 'vendor/jquery/jquery.scrollTo',
1514
'jquery.elastic': 'vendor/jquery/jquery.elastic.source.antarus66fork',
@@ -27,42 +26,20 @@ requirejs.config({
2726
ckeditor: 'vendor/ckeditor/ckeditor',
2827
'ckeditor.custom.settings': 'vendor/ckeditor/custom-instance-settings',
2928
'ckeditor.adapter': 'vendor/ckeditor/adapters/jquery',
30-
'highlight': 'vendor/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack',
31-
'moment': 'vendor/moment/moment-with-locales',
32-
'progressbar': 'vendor/progressbar/progressbar',
29+
highlight: 'vendor/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack',
30+
moment: 'vendor/moment/moment-with-locales',
31+
progressbar: 'vendor/progressbar/progressbar',
3332
i18next: 'vendor/i18next/i18next-1.10.1',
3433
updown: 'vendor/updown/updown'
3534
},
3635
shim: {
37-
underscore: {
38-
exports: '_'
39-
},
40-
backbone: {
41-
deps: ['jquery', 'underscore'],
42-
exports: 'Backbone'
43-
},
44-
'backbone.syphon': ['backbone'],
45-
marionette: {
46-
deps: ['backbone'],
47-
exports: 'Marionette'
48-
},
49-
bootstrap: ['jquery'],
50-
validation: ['backbone'],
51-
tpl: ['text'],
52-
syphon: ['backbone'],
5336
'ckeditor.adapter': ['ckeditor'],
54-
select2: {
55-
deps: ['jquery'],
56-
exports: '$.fn.select2'
57-
},
58-
'jquery.scroll': ['jquery'],
59-
'jquery.elastic': ['jquery'],
60-
'jquery.iframe-resizer': ['jquery'],
61-
updown: ['jquery.scroll']
37+
i18next: ['jquery'],
38+
'jquery.elastic': ['jquery']
6239
}
6340
});
6441

65-
require(['app', 'routes', 'i18next'], function (App) {
42+
require(['i18next', 'app', 'routes'], function (Lang, App) {
6643
// App in i18next context for inserting _t() helper inside the all templates
6744
var i18nOptions = {
6845
useCookie: true,

public/js/vendor/updown/updown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require(['app', 'jquery', 'jquery.scroll'], function (App) {
1+
define(['jquery', 'jquery.scroll'], function (App) {
22
jQuery.extend(jQuery.fn, {
33
toplinkwidth: function () {
44
var totalContentWidth = jQuery('#page-content-wrapper').outerWidth();

public/js/views/folder/select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ define([
2525
className: 'folder-select',
2626
template: SelectTpl,
2727
childView: App.Folder.Views.FolderSelectRow,
28-
childViewContainer: "#folder-options",
28+
childViewContainer: '#folder-options',
2929

3030
onShow: function () {
3131
var lang = i18n.lng().substr(0, 2);

public/js/views/main-layout.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ define([
55
'views/menu/mock',
66
'tpl!views/templates/main-layout.tpl',
77
'moment',
8-
'syphon',
9-
'updown'
8+
'syphon'
109
], function (
1110
App,
1211
Marionette,

public/js/views/paginator/paginator.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,24 @@ define([
44
'backbone',
55
'tpl!views/templates/paginator/collection.tpl',
66
'tpl!views/templates/paginator/row.tpl',
7+
'tpl!views/templates/paginator/more.tpl',
78
'marionette'
89
], function (
910
App,
1011
Marionette,
1112
Backbone,
1213
PaginatorTpl,
13-
PaginatorRowTpl
14+
PaginatorRowTpl,
15+
PaginatorMoreTpl
1416
) {
1517
App.Paginator.Views.PaginatorCollectionRow = Marionette.ItemView.extend({
1618
tagName: 'li',
17-
template: PaginatorRowTpl,
19+
getTemplate: function () {
20+
if (this.model.type === 'more') {
21+
return PaginatorMoreTpl;
22+
}
23+
return PaginatorRowTpl;
24+
},
1825
initialize: function (options) {
1926
this.$el.addClass(this.model.get('type'));
2027
if (this.model.get('is_disabled')) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a><%= title %></a>
+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
<% if (type === 'more') %>
2-
<a><%= title %></a>
3-
<% else %>
4-
<a href="#"><%= title %></a>
5-
1+
<a href="#"><%= title %></a>

0 commit comments

Comments
 (0)