/
params.json
1 lines (1 loc) · 7.04 KB
/
params.json
1
{"note":"Don't delete this file! It's used internally to help with page regeneration.","tagline":"Create & manage mobile & desktop sites using HTML5 & CSS3","body":"site-manager [<img src=\"https://secure.travis-ci.org/jolira/site-manager.png\" />](http://travis-ci.org/#!/jolira/site-manager)\r\n========================================\r\n\r\nA simple server for developing single-page applications quickly in a team environment.\r\n\r\nThe core of the server are handlebar templates. Here is one handlebar template that \r\ncomes with the site-manager at [``public/index.html``](https://github.com/jolira/site-manager/blob/master/public/index.html).\r\n\r\n\r\nA Very Simple Example\r\n-----------------------------\r\n\r\nCreate a new directory demo appliation in a new directory, such as...\r\n\r\n```bash\r\nmkdir mydemoapp\r\ncd mydemoapp\r\n```\r\n\r\nCreate a new ``package.json``, declaring site-manager as a dependency.\r\n\r\n```json\r\n{\r\n \"name\": \"mydemoapp\",\r\n \"version\": \"0.0.1\",\r\n \"dependencies\": {\r\n \"site-manager\": \"*\"\r\n },\r\n \"main\":\"index\",\r\n \"engines\":{\r\n \"node\":\">= 0.6.0 < 0.7.0\"\r\n }\r\n}\r\n```\r\n\r\nDeclaring the site-manager isn't strictly required, but makes deploying to many systems (such as Heroku) much\r\neasier. Instead of declaring the dependency, one can also install the site-manager globally using\r\n``npm install -g site-manager``.\r\n\r\n\r\nNext, we need a ``index.js`` file:\r\n\r\n```javascript\r\n(function (__dirname, module) {\r\n \"use strict\";\r\n var path = require(\"path\");\r\n module.exports = function (defaults, cb, properties, app) {\r\n defaults.useRequireJS = false; // disable the site-manager support for requireJS\r\n defaults.hostname = \"mydemoapp.jolira.com\"; // define the name of the site\r\n defaults.title = \"My Demo App\"; // The title to be displayed in the titlebar\r\n defaults.htmlFiles = [\r\n path.join(__dirname, \"content.html\") // add some content\r\n ];\r\n return cb(undefined, defaults);\r\n };\r\n})(__dirname, module);\r\n```\r\n\r\nNow, all that is remaining is to specify the HTML-fragment to be displayed when we run the site-manager.\r\n\r\n```html\r\n<h1>Hello World!!!</h1>\r\n```\r\n\r\nTo install the dependencies:\r\n\r\n```bash\r\nnpm install -d\r\n```\r\n\r\nTo run the example:\r\n\r\n```bash\r\n$ node_modules/.bin/site-manager --debug --port=3000 .\r\n```\r\n\r\nTo run the example on Heroku you need the following ``Procfile`:\r\n\r\n```\r\nweb: node_modules/.bin/site-manager --debug --port=$PORT --watch-dirs=false .\r\n```\r\n\r\nGo to ``http://localhost:3000`` to get the example running.\r\n\r\nConfiguring a Site\r\n------------------------\r\n\r\nAs shown in the example, every site-manager site has configures the site by exporting a function. This function\r\nlooks like this:\r\n\r\n```javascript\r\n \"use strict\";\r\n module.exports = function (defaults, cb, properties, app) {\r\n // configure the defaults object here\r\n return cb(undefined, defaults);\r\n };\r\n```\r\n\r\nThe default object takes the following parameters:\r\n\r\n* ``defaults``: The defaults object to be configured. A detailed description of the properties\r\n of this object can be found at\r\n [``lib/defaults.json``](https://github.com/jolira/site-manager/blob/master/lib/defaults.js).\r\n The [``public/index.html``](https://github.com/jolira/site-manager/blob/master/public/index.html) shows\r\n how may of these values are used.\r\n* ``cb`` the the callback function, which takes two parameters ``cb(err, vals)``. The first parameter\r\n should be set to ``undefined``unless there is an error to report. The second parameter should be used\r\n to pass the configured default object back to the site-manager.\r\n* ``properties`` loaded from a ``.config.json`` file in the project directory.\r\n* ``app`` the [express.js](http://expressjs.com/) object used by the site-manager.\r\n\r\nOther Features\r\n------------------------\r\n\r\nKey features of this package are:\r\n\r\n* _Teams_: Break the the app into many HTML fragments to make team development easier.\r\n* _HTML5Boilerplate_: Our default templates incorporate the latest & greatest boilerplate.\r\n* _RequireJS_: Teams can (optionally) use [Asynchronous Module Definition](https://github.com/amdjs/amdjs-api/wiki/AMD)\r\n to organize their JavaScript.\r\n* _Auto Reloads_: The site-manager watches the filesystem for changes, automatically reloading a site when it\r\n detects a change.\r\n* _Less_: Automatically compiles ``.less`` files to ``text/css using``.\r\n* _Properties_: The site-manager loads ``.config.json`` files from the site directory. The site-manager also loads\r\n properties from a ``~/.sitemanager.json`` file, and passes the data to the different sites it serves.\r\n* _Manifest_: The site-manager automatically updates [HTML5\r\n manifest](http://www.html5rocks.com/en/tutorials/appcache/beginner/) when changes are detected that require reloading\r\n the site.\r\n* _Developer Support_: The server monitors files and automatically restarts when changes are detected.\r\n\r\n### Multi-Site Mode\r\n\r\nThe site-manager can run in multi-site mode, which creates virtual hosts for each module. The hostname is defined in\r\nthe site is used as the server name of the vhost.\r\n\r\nIn order to run in multi-site mode, point the site-manager to a directory that contains mutiple sites, such as in\r\n\r\n```\r\nsite-manager examples # use the examples directory from the repo\r\n```\r\n\r\nTo test sites you have to define the correct hostname. In order to do so, you have to add these names to `/etc/hosts`.\r\nTo define the hostames used by examples from the site-manager github repo, add the following line to `/etc/hosts`\r\n(assuming you are running the site-manager on your machine):\r\n\r\n```\r\n127.0.0.1 simple.jolira.com advanced.jolira.com\r\n```\r\n\r\nOnce this entry has been added, you can access the advanced example as `http://advanced.jolira.com:3000` and the simple\r\nexample at `http://simple.jolira.com:3000`.\r\n\r\n### Single-Site Mode\r\n\r\nWhen running in single-site mode, there is no vhosting (as only one site is served). To run the site-manager in\r\nsingle-site mode, point it to a site directory as in:\r\n\r\n```\r\nsite-manager examples/simple # use the examples directory from the repo\r\n```\r\n\r\nAs there is no virtual hosting, we do not have to define any entry in `/etc/hosts` and can access the example at\r\n`http://localhost:3000`.\r\n\r\n### Enable Debug Output\r\n\r\nDebug output is generated when the string `site-manager` is part of the value of the ``NODE_DEBUG`` environment\r\nvariable.\r\n\r\n```bash\r\nexport NODE_DEBUG=site-manager\r\n```\r\n\r\nTesting\r\n-----------------\r\n\r\nInstall jake: `npm install -g jake`\r\n\r\nNote that Jake is a system-level tool, so it wants to be installed globally.\r\n\r\nTo execute tests execute: `jake test`\r\n\r\nLicense\r\n-----------------\r\n\r\n[MIT License](https://raw.github.com/jolira/site-manager/master/LICENSE.txt)\r\n\r\n","name":"Site-manager","google":"UA-3602945-1"}