diff --git a/lib/app/js/app.js b/lib/app/js/app.js
index 1334dc02..1e11bec0 100644
--- a/lib/app/js/app.js
+++ b/lib/app/js/app.js
@@ -92,11 +92,11 @@ angular.module('sgApp', [
function loadModule($ocLazyLoad) {
if (window.filesConfig && window.filesConfig.length) {
- var fileNames = [];
- angular.forEach(window.filesConfig, function(file) {
- fileNames.push(file.name);
+ var moduleNames = [];
+ angular.forEach(window.filesConfig, function(lazyLoadmodule) {
+ moduleNames.push(lazyLoadmodule.name);
});
- return $ocLazyLoad.load(fileNames);
+ return $ocLazyLoad.load(moduleNames);
}
}
diff --git a/lib/app/sass/styleguide-app.scss b/lib/app/sass/styleguide-app.scss
index 1085f1f7..ebf3314d 100644
--- a/lib/app/sass/styleguide-app.scss
+++ b/lib/app/sass/styleguide-app.scss
@@ -1251,7 +1251,7 @@ Styleguide 4.4
//
// sg-angular-directive:
// name: sgAppTest
-// template: demo/testDirective.html
+// file: demo/testDirectiveInit.js
// file: demo/testDirective.js
//
// Styleguide 6.1
@@ -1262,11 +1262,23 @@ Styleguide 4.4
-webkit-user-select: none;
-ms-user-select: none;
padding: 0.2em;
- border: 1px solid red;
+ border: 2px solid red;
display: initial;
cursor: pointer;
}
+// Test directive2
+//
+// markup:
+//
If you see this something is wrong
+//
+// sg-angular-directive:
+// name: sgAppTest
+// file: demo/testDirectiveInit.js
+// file: demo/testDirectiveTwo.js
+//
+// Styleguide 6.2
+
// styleguide:ignore:start
@include styleguide_custom_styles;
// styleguide:ignore:end
diff --git a/lib/demo/testDirective.js b/lib/demo/testDirective.js
index 7caf08ce..16bdfca8 100644
--- a/lib/demo/testDirective.js
+++ b/lib/demo/testDirective.js
@@ -2,7 +2,7 @@
// Test directive is used to demo lazy loading external directive in the test project
-angular.module('sgAppTest', [])
+angular.module('sgAppTest')
.controller('sgAppTest', function($scope) {
$scope.clickCount = 0;
$scope.incrementClicks = function() {
diff --git a/lib/demo/testDirectiveInit.js b/lib/demo/testDirectiveInit.js
new file mode 100644
index 00000000..e8c31827
--- /dev/null
+++ b/lib/demo/testDirectiveInit.js
@@ -0,0 +1 @@
+angular.module('sgAppTest', []);
diff --git a/lib/demo/testDirectiveTwo.js b/lib/demo/testDirectiveTwo.js
new file mode 100644
index 00000000..a2e8ed49
--- /dev/null
+++ b/lib/demo/testDirectiveTwo.js
@@ -0,0 +1,16 @@
+'use strict';
+
+angular.module('sgAppTest')
+ .controller('sgAppTest', function($scope) {
+ $scope.clickCount = 0;
+ $scope.incrementClicks = function() {
+ $scope.clickCount += 1;
+ };
+ })
+ .directive('sgTestDirectiveTwo', function() {
+ return {
+ replace: true,
+ restrict: 'A',
+ templateUrl: 'demo/testDirective.html'
+ };
+ });
diff --git a/lib/styleguide.js b/lib/styleguide.js
index b6b1931c..df55e966 100644
--- a/lib/styleguide.js
+++ b/lib/styleguide.js
@@ -67,6 +67,24 @@ function emitCompileSuccess() {
}
}
+function groupModuleFiles(allModules) {
+ // Group modules by module name
+ var namedModules = _.groupBy(allModules, function(module) {
+ return module.name;
+ });
+
+ // Commbile files from every module that has the same name
+ return _.map(namedModules, function(modules, moduleName) {
+ var files = _.uniq(_.reduce(modules, function(files, singleModule) {
+ return files.concat(singleModule.files);
+ }, []));
+ return {
+ name: moduleName,
+ files: files
+ };
+ });
+}
+
function generateSectionWrapperMarkup(json) {
json.section = wrapperMarkup.generateSectionWrapperMarkup(json.sections);
}
@@ -291,7 +309,7 @@ module.exports.generate = function(options) {
styleguideConfig: JSON.stringify(copyUsedOptionsToInlineJsonConfig(opt, {}).config),
appRoot: opt.appRoot,
socketIo: opt.server,
- filesConfig: JSON.stringify(opt.filesConfig)
+ filesConfig: JSON.stringify(groupModuleFiles(opt.filesConfig))
}))
.pipe(pushAllFiles())
.on('finish', resolve);