diff --git a/@salix/app/src/fake.js b/@salix/app/src/fake.js
new file mode 100644
index 000000000..df7f4a45f
--- /dev/null
+++ b/@salix/app/src/fake.js
@@ -0,0 +1,41 @@
+export const graphRoutes = {
+ routes: [
+ {
+ url: '/index',
+ state: 'index',
+ template: '',
+ module: 'compras',
+ description: '',
+ image: '',
+ },
+ {
+ url: '/add',
+ state: 'add',
+ template: '',
+ module: 'compras',
+ description: '',
+ image: '',
+ },
+ {
+ url: '/edit',
+ state: 'edit',
+ template: '',
+ module: 'compras',
+ description: '',
+ image: '',
+ },
+ {
+ url: '/delete',
+ state: 'delete',
+ template: '',
+ module: 'compras',
+ description: '',
+ image: '',
+ }
+ ],
+
+ graphDependendies: {
+ compras:["crud"],
+ crud:[]
+ }
+};
\ No newline at end of file
diff --git a/@salix/app/src/routes.js b/@salix/app/src/routes.js
index 25d5fd78d..d0f3817f3 100644
--- a/@salix/app/src/routes.js
+++ b/@salix/app/src/routes.js
@@ -1,21 +1,34 @@
import * as core from '@salix/core';
-import * as spliting from './spliting';
+import * as spliting from './spliting';
+import {routes} from './fake';
core.module.config(function($stateProvider, $urlRouterProvider) {
- $urlRouterProvider.otherwise("/");
+
+ core.splitingRegister.registerGraph('hello');
- $stateProvider
- .state('index', {
- url: "/index",
- template :'',
+ function xxx(route){
+ return function loader($ocLazyLoad, $q){
+ return $q((resolve) => {
+ core.splitingRegister.execute(route.module)
+ spliting[route.module](() => {
+ //resolve($ocLazyLoad.load({name: route.module}));
+
+ });
+ });
+ };
+ }
+
+ $urlRouterProvider.otherwise("/");
+
+ routes.forEach(function(route) {
+ $stateProvider.state(route.state, {
+ url: route.url,
+ template :route.template,
resolve: {
- loader: function($ocLazyLoad, $q){
- return $q((resolve) => {
- spliting.crud($ocLazyLoad, resolve);
- });
- }
+ loader: xxx(route)
}
- })
+ })
+ }, this);
});
diff --git a/@salix/app/src/spliting.js b/@salix/app/src/spliting.js
index 052620631..f60b2d5c3 100644
--- a/@salix/app/src/spliting.js
+++ b/@salix/app/src/spliting.js
@@ -1,14 +1,14 @@
-export const crud = (lazy, resolve) => {
- require.ensure([], () => {
- var module = require('@salix/crud');
- resolve(lazy.load({name:'crud'}));
- }, "salix.crud");
-};
-export const compras = () => {
+import * as core from '@salix/core';
+
+
+
+export const compras = (cb) => {
require.ensure([], () => {
require('@salix/compras')
+ cb();
}, "salix.compras");
};
+
export const ventas = () => {
require.ensure([], () => {
require('@salix/ventas')
@@ -18,4 +18,4 @@ export const pagos = () => {
require.ensure([], () => {
require('@salix/pagos')
}, "salix.pagos");
-};
\ No newline at end of file
+};
diff --git a/@salix/compras/routing.json b/@salix/compras/routing.json
new file mode 100644
index 000000000..ac6307544
--- /dev/null
+++ b/@salix/compras/routing.json
@@ -0,0 +1,4 @@
+{
+ "route": "buys",
+ "template": "buys.template"
+}
diff --git a/@salix/core/src/core.js b/@salix/core/src/core.js
index 244e3735a..34075fc61 100644
--- a/@salix/core/src/core.js
+++ b/@salix/core/src/core.js
@@ -1,8 +1,9 @@
/**
* export public module
*/
-export * from './module';
-export * from './util';
+export * from './module'
+export * from './util'
+export {SplitingRegister as splitingRegister} from './splitingregister'
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
export {NAME as BUTTON,directive as ButtonDirective} from './button/button'
diff --git a/@salix/core/src/splitingregister.js b/@salix/core/src/splitingregister.js
new file mode 100644
index 000000000..e60c5c7e1
--- /dev/null
+++ b/@salix/core/src/splitingregister.js
@@ -0,0 +1,32 @@
+const _SplitingRegister = ()=>{
+
+ var _graph;
+ var dependencies = {};
+
+ return {
+ registerGraph: function(graph){
+ _graph = graph;
+ },
+ register: function(dependency,loader){
+ dependencies[dependecy]=loader;
+ },
+ execute: function(dependency){
+
+ var _array=[];
+ _array.push(dependency);
+ var fist =graph[dependency];
+
+ //TODO:create dependy graph
+
+
+ while(key=array.pop()){
+ dependencies[key]();
+ }
+
+ },
+ write:function(){
+ console.log(_graph);
+ }
+ }
+};
+export const SplitingRegister = _SplitingRegister();
diff --git a/@salix/crud/src/spliting.js b/@salix/crud/src/spliting.js
new file mode 100644
index 000000000..ba7ec12a6
--- /dev/null
+++ b/@salix/crud/src/spliting.js
@@ -0,0 +1,8 @@
+
+
+export const crud = (cb) => {
+ require.ensure([], () => {
+ require('@salix/crud');
+ cb();
+ }, "salix.crud");
+};
\ No newline at end of file
diff --git a/@salix/ventas/routing.json b/@salix/ventas/routing.json
new file mode 100644
index 000000000..ef776755e
--- /dev/null
+++ b/@salix/ventas/routing.json
@@ -0,0 +1,4 @@
+{
+ "route": "sales",
+ "template": "sales.template"
+}
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 000000000..6fbf8aebc
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,16 @@
+
+var gulp = require ('gulp');
+var jsoncombine = require ('gulp-jsoncombine');
+
+function combineFunc (data)
+{
+ return new Buffer (JSON.stringify (data));
+}
+
+gulp.task ('default', function ()
+{
+ var json = gulp.src ('./@salix/**/routing.json')
+ .pipe (jsoncombine ('salix.routes.json', combineFunc))
+ .pipe (gulp.dest ('./build'));
+});
+
diff --git a/index.html b/index.html
index d540b5ff1..b506e8e60 100644
--- a/index.html
+++ b/index.html
@@ -4,14 +4,13 @@
Salix
-
-
+
+