Spine.js hem server, hem build FAQ for Windows

I am trying to reproduce some basic functions of the Todos example. After reading spinejs.com, many articles, and having made several attempts and not straying, I need to ask and get help here. I would like this to be clearer, and I would also like to help others. I am on Windows7 and I am using spine.app to create my application, controllers, models - also using jQuery.tmpl I am using CS, but new to this.

I'm not quite sure where I need to use require (if at all) - I use the modules.exports = .... command for all M, C so index.coffee should be able to find, I suppose Maybe it's not - I I see, although the controllers / contacts used the modules.exports operator, the index was still used.

Is index.coffee just special? I see that Contacts uses Contacts without any requirements.

I saw how the main.App Controller is created from CS, like in Todos or in the jQuery () script in html, like in Contacts.
I assume that you should either -build it all and enable application.js OR -use the jQuery () function to create the application through javascript.

If this compiles, will it be in public / application.js ??

I get an unpleasant parsing error, and yes, I know that you should always use spaces (no tabs)

Which, aside, I get a hang on the first line required ('Library / customization')

Will I need Cygwin stuff? I can get it if that helps.
and I saw google groups, guillaume86 comments, input and CS irc feed.

I'm not sure that I have a (date) version of the edge, but I tried minify: false, option, and a few other things to try to debug this.

The good news: I'm pretty stubborn and get it if I can help a bit here. Still to come, but I'm going to close at this moment.
Thanks in advance for your suggestions.

+4
source share
1 answer

I donโ€™t think this will help the OP too much, but thought that I would write it to help someone else who wants to get started with these amazing tools.

Before moving on : I rewrote this with updates How do I manage client-side JavaScript dependencies?

Here is the basic list to configure using the Spine, hem, coffeescript application. I only develop on Linux, so I'm not sure that some of these steps will have problems with windows, namely npm commands. Should work well on Mac; I know others who use the same toolchain.

  • Install NPM: curl http://npmjs.org/install.sh | sh curl http://npmjs.org/install.sh | sh to the * nix system. I assume this is available from the command line.
  • npm install -g spine.app will make spinal availability accessible with a global command
  • spine app folder will create a Spine project called app in folder , creating the correct directory structure and a bunch of skeletal files to get started.
  • cd to the folder and edit dependencies.json for the libraries you need. Add them to slug.json so that the hem knows where to find them. You can install hem globally ( npm install -g hem ) or locally, as in the next step.
  • npm install . to download all the dependencies you just entered, including hem.
  • If you look at the default spine configuration, there is app/lib/setup.coffee , where you require all the libraries you need from your dependencies. Examples:

     # Spine.app had these as dependencies by default require('json2ify') require('es5-shimify') require('jqueryify') require('spine') require('spine/lib/local') require('spine/lib/ajax') require('spine/lib/manager') require('spine/lib/route') # d3 was installed via dependencies.json require 'd3/d3.v2' 
  • In index.coffee you just require lib/setup and load the main controller for your application. In addition, you need to require any other classes in these other controllers.

  • By default, the created index.html is generally suitable for downloading your application, but change it if necessary.
  • From the folder run node_modules/hem/bin/hem server to start the header server, and go to localhost:9294 to see your application. If you installed hem globally ( npm install -g hem ), then the hem server itself may work, but sometimes it gets confused along the way.
  • Build the rest of your application using proper MVC methods and use styluses for CSS and eco for presentations.

One more thing: usually the hem server will automatically update when the code is updated and the files are saved, which forces it to debug cinch. Running hem build compile your application into two files, application.js , which will be reduced and application.css . If after that you start the hem server , it will use these files and will no longer be updated automatically. So donโ€™t hem build until you need a mini version of your deployment application.

See this other topic: Spine.js and getting started at the beginning.

Windows is supported (there were problems in the past, but they were fixed ). In fact, there is a hem branch, which is developing more actively, since the original branch is no longer supported by the developer. You can check the version0_2 or version0_3 that received updates and may eventually get Windows support.

NTN.

+4
source

Source: https://habr.com/ru/post/1398165/


All Articles