diff --git a/_template/app/js/main.js b/_template/app/js/main.js index c5175a7..aba1cb0 100644 --- a/_template/app/js/main.js +++ b/_template/app/js/main.js @@ -485,15 +485,33 @@ new Vue({ _this.$http.get('./data.json' + '?cb=' + new Date()).then(function (response) { _this.initData(response.data, function() { - if(_this.$data.groups.length) { - _this.setupGroups(); - } else { - _this.logInfo('You need to add a component to your library before it can be loaded.
You can either do this manually by editing your data.json file,
or you can use the command line helper: astrum new [group_name/component_name]'); - } + _this.$http.get('./assets.json' + '?cb=' + new Date()).then(function (response) { + _this.initCustomData(response.data, 'assets', function() { + // Initialize groups after finding and merging custom asset overrides. + _this.initializeGroups(); + }); + }).catch(function() { + // Initialize groups after failing to find custom asset overrides. + _this.initializeGroups(); + }); }); }); }, + /** + * Initialize the groups, display a message if no groups have been added. + */ + + initializeGroups: function() { + var _this = this; + + if(_this.$data.groups.length) { + _this.setupGroups(); + } else { + _this.logInfo('You need to add a component to your library before it can be loaded.
You can either do this manually by editing your data.json file,
or you can use the command line helper: astrum new [group_name/component_name]'); + } + }, + /** * Determine if a page should be loaded. */ @@ -534,6 +552,23 @@ new Vue({ callback(); }, + /** + * Initilise data bindings. + * + * @param data + */ + initCustomData: function(data, key, callback) { + callback = typeof callback !== 'undefined' ? callback : function() {}; + + var _this = this; + + // Override assets + if(data) { + _this.$set(key, data); + } + callback(); + }, + /** * Update URL hash. *