Skip to content

Commit

Permalink
update gulp to manage language files
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwoulfe committed Feb 6, 2020
1 parent 99094f6 commit 196cf62
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 42 deletions.
32 changes: 19 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const urls = {
js: 'src/**/*.js',
html: 'src/**/*.html',
css: 'src/**/*.css',
lang: 'src/**/*.xml',
devManifest: 'src/**/package.dev.manifest',
prodManifest: 'src/**/package.prod.manifest',
dist: 'dist/',
Expand All @@ -29,26 +30,31 @@ gulp.task('clean', () =>

gulp.task('js', () =>
gulp.src(urls.js)
.pipe(config.prod ? babel() : util.noop())
.pipe(config.prod ? concat('preserver.min.js') : util.noop())
.pipe(config.prod ? uglify() : util.noop())
.pipe(gulp.dest(urls.dest + (config.prod ? config.folder + '/backoffice' : '')))
.pipe(config.prod ? babel() : util.noop())
.pipe(config.prod ? concat('preserver.min.js') : util.noop())
.pipe(config.prod ? uglify() : util.noop())
.pipe(gulp.dest(urls.dest + (config.prod ? config.folder + '/backoffice' : '')))
);

gulp.task('manifest', () =>
gulp.src(config.prod ? urls.prodManifest : urls.devManifest)
.pipe(rename('package.manifest'))
.pipe(gulp.dest(urls.dest + config.folder))
.pipe(rename('package.manifest'))
.pipe(gulp.dest(urls.dest + config.folder))
);

gulp.task('html', () =>
gulp.task('html', () =>
gulp.src(urls.html)
.pipe(gulp.dest(urls.dest))
.pipe(gulp.dest(urls.dest))
);

gulp.task('css', () =>
gulp.task('lang', () =>
gulp.src(urls.lang)
.pipe(gulp.dest(urls.dest))
);

gulp.task('css', () =>
gulp.src(urls.css)
.pipe(gulp.dest(urls.dest))
.pipe(gulp.dest(urls.dest))
);

gulp.task('export', done => {
Expand All @@ -74,7 +80,7 @@ gulp.task('export', done => {

// gulp watch --dest '../path/to/app_plugins'
gulp.task('watch', () => {
gulp.watch([urls.js, urls.html, urls.css, urls.devManifest], gulp.series('default'));
});
gulp.watch([urls.js, urls.html, urls.css, urls.lang, urls.devManifest], gulp.series('default'));
});

gulp.task('default', gulp.series('clean', 'js', 'html', 'css', 'manifest', 'export'));
gulp.task('default', gulp.series('clean', 'js', 'html', 'css', 'lang', 'manifest', 'export'));
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "NestingContently",
"name": "Preserver",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
Expand Down
20 changes: 1 addition & 19 deletions src/Preserver/backoffice/app.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
(() => {

angular.module('preserver', []);

// .config(['$provide', $provide => {
// $provide.decorator("$rootScope", function ($delegate) {
// var Scope = $delegate.constructor;
// var origBroadcast = Scope.prototype.$broadcast;
// var origEmit = Scope.prototype.$emit;
//
// Scope.prototype.$broadcast = function () {
// console.log("$broadcast was called on $scope " + Scope.$id + " with arguments:", arguments);
// return origBroadcast.apply(this, arguments);
// };
// Scope.prototype.$emit = function () {
// console.log("$emit was called on $scope " + Scope.$id + " with arguments:", arguments);
// return origEmit.apply(this, arguments);
// };
// return $delegate;
// });
// }]);
//
angular.module('umbraco').requires.push('preserver');

})();

16 changes: 8 additions & 8 deletions src/Preserver/backoffice/editor.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
*
*/
const debounce = (callback, interval) => {
let timeout = null;
let timeout = null;

return () => {
$timeout.cancel(timeout);
timeout = $timeout(() => callback.apply(this, arguments), interval);
$timeout.cancel(timeout);
timeout = $timeout(() => callback.apply(this, arguments), interval);
}
};

Expand All @@ -22,7 +22,7 @@
*/
const findAncestor = (el, cls) => {
while ((el = el.parentElement) && !el.classList.contains(cls));
return el;
return el;
};


Expand All @@ -48,7 +48,7 @@
}
}


/**
*
*/
Expand Down Expand Up @@ -92,7 +92,7 @@
propElm.style.display = 'none';
if (!propElm.nextElementSibling) {
propElm.previousElementSibling.querySelector('.control-group').classList.add('p-last-child');
}
}
}

const fromStore = localStorage.getItem(dataKey);
Expand All @@ -101,7 +101,7 @@
key: 'preserver_notice',
view: `${Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath}/preserver/backoffice/notification.html`
});
}
}


/**
Expand Down Expand Up @@ -132,7 +132,7 @@
if (editorState.current.variants.some(x => x.isDirty)) {
localStorage.setItem(dataKey, getBasicModel(editorState.current));
}
}, 1000), true);
}, 300), true);

} else {
watcher ? watcher() : angular.noop();
Expand Down
2 changes: 1 addition & 1 deletion src/Preserver/backoffice/notification.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
// register controller
angular.module('preserver').controller('preserver.notification.controller', ['$rootScope', 'notificationsService', 'editorState', notificationController]);
})();

1 change: 1 addition & 0 deletions src/Preserver/lang/en-US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
<key alias="foundContent">Importing will update properties where the rescued content is different to the last saved content. Import?</key>
</area>
</language>

0 comments on commit 196cf62

Please sign in to comment.