From 8a67a9f172562973cbc243382e5d2326489b932c Mon Sep 17 00:00:00 2001 From: josdejong Date: Thu, 18 Apr 2013 14:51:59 +0200 Subject: [PATCH] Css is now packages in the js file. --- HISTORY.md | 12 +++ Jakefile.js | 29 +++--- README.md | 4 +- examples/timeline/01_basic.html | 1 - examples/timeline/02_dataset.html | 8 +- src/component/item/itembox.js | 3 +- src/component/item/itempoint.js | 2 +- src/component/itemset.js | 3 +- src/component/timeaxis.js | 15 ++-- src/module.js | 25 ++++++ src/util.js | 47 ++++++++-- test/timeline.html | 4 +- vis.css | 142 ------------------------------ vis.js | 101 ++++++++++++++++----- vis.min.js | 10 +-- 15 files changed, 196 insertions(+), 210 deletions(-) create mode 100644 HISTORY.md create mode 100644 src/module.js delete mode 100644 vis.css diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 00000000..ccfb6928 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,12 @@ +vis.js history +http://visjs.org + +## + +- Css is now packaged in the javascript file, and automatically loaded. + + +## 2012-04-16, version 0.0.5 + +- First working version of the Timeline +- Website created. diff --git a/Jakefile.js b/Jakefile.js index 25f329ff..1e412574 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -22,7 +22,18 @@ desc('Build the visualization library vis.js'); task('vis', function () { var VIS = './vis.js'; var VIS_MIN = './vis.min.js'; - var VIS_CSS = './vis.css'; + + // concatenate and stringify css files + var result = concat({ + src: [ + './src/component/css/panel.css', + './src/component/css/item.css', + './src/component/css/timeaxis.css' + ], + header: '/* vis.js stylesheet */', + separator: '\n' + }); + var cssText = JSON.stringify(result.code); // concatenate the script files concat({ @@ -36,6 +47,7 @@ task('vis', function () { './src/stack.js', './src/range.js', './src/controller.js', + './src/module.js', './src/component/component.js', './src/component/panel.js', @@ -48,18 +60,11 @@ task('vis', function () { './lib/moment.js' ], - separator: '\n' - }); + separator: '\n', - // concatenate the css files - concat({ - dest: VIS_CSS, - src: [ - './src/component/css/panel.css', - './src/component/css/item.css', - './src/component/css/timeaxis.css' - ], - separator: '\n' + // Note: we insert the css as a string in the javascript code here + // the css will be injected on load of the javascript library + footer: 'loadCss(' + cssText + ');' }); // minify javascript diff --git a/README.md b/README.md index 59bb785c..65ceee62 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,10 @@ Or download the library from the github project: ## Load -To use a component, include the javascript and css file of vis in your webpage. +To use a component, include the javascript file of vis in your webpage. ```html - ``` A timeline can be instantiated as: @@ -53,7 +52,6 @@ of the project. Timeline basic demo -