Skip to content

Running a localhost server

MadRabbit edited this page Jul 10, 2012 · 1 revision

in case you don't want to use cdn.lovely.io server and download all the scripts from there during development process, you can easily setup your own local server.

Setting Up

Setup is crazily simple, all you need is to install the lovely package through the NPM service

npm install lovely -g

Don't forget that -g key, so that npm installed the lovely console tools

Once it's finished, you can simply launch the lovely server command in your terminal and use the http://127.0.0.1:3000 address instead of the http://cdn.lovely.io one

<html>
  <head>
    <script src="http://<%= production ? 'cdn.lovely.io' : 'localhost:3000' %>/core.js"></script>
    <script type="text/javascript">
      Lovely(['dom', 'ajax'], function($, Ajax) {
        // do stuff here
      });
    </script>
  </head>
</html>

You certainly can run it on any other port than 3000, see the lovely help server for more details

Packages Management

Once you installed the lovely package through the NPM service, it will automatically install all the stl packages. If you need anything else from the lovely.io service, you can easily install it by using the same lovely CLI toolkit

lovely install ui
lovely install dialog
lovely install highscore

NOTE: this will automatically install all the dependencies as well

All those packages will be automatically saved in the ~/.lovely/ directory on your computer an then will be available through the lovely server the same exact way as they do on the cdn.lovely.io.

If you need to update installed packages just call lovely update in your console. it will automatically update all the installed packages.

Clone this wiki locally