Search code examples
javascriptgulpaureliajspm

Finishing up an aurelia application


I'm currently preparing to release my first aurelia based application. I've got nearly everything figured out, except some small details.

Loading css first

I found myself wanting to load some of the css before the application starts; specifically, animation logic for the loading div. I want this because otherwise the spinner won't spin. I know I can just include the spinner css separately, but I need (want) the animate lib anyway, so might as well add it. I've added the following to my index.html:

<link href="jspm_packages/github/daneden/[email protected]/animate.min.css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
<link href="dist/styles/style.css" rel="stylesheet"/>

This feels wrong for two reasons. First, I can bundle this css with aurelia-bundler, so shouldn't I? And secondly, which actually brings me to my next question...

What goes in VC?

animate is in jspm_packages, which feels like it shouldn't be in version control. However, I do need the file. So, I could perhaps opt to copy the file to dist/ in my build process. This question also applies to the dist/ dir, which now contains the bundled files (made by aurelia-bundler) as well as my static assets (less to css, optimized images and minified json files), but also the source files used for dev (es2015-compiled files). The dist dir is in .gitignore as well as jspm_packages. Images get loaded from dist/ and so do stylesheets. index.html isn't in dist, so I can't use relative paths and simply make a build directory. I'm a bit stuck here.

Update: Another example of a file that should be deployed, is jspm_packages/system.js. That's in jspm_packages, which isn't in version control.


Solution

  • I would agree: jspm_packages and its contents should probably not be under source control during development.

    But that does not stop you deploying those artefacts as part of a build process. For example, my output directory for a deployable build would look something like:

    /deploy
        /jspm_packages
            system.js
            system-polyfills.js
        app-bundle-vXXX-js
        config.js
        index.html
    

    None of the above would be under my normal development version control. Same goes for anything else generated (css from SASS/LESS, etc) and other 3rd party stuff that is not included in the bundle.

    But that does not stop me generating a separate built/released/deployed versions of the above /deploy output (probably zipped or tarred ready to dump onto the deployment servers) if I need to keep track of versioned releases. In theory, I could recreate the build any time from the versioned source, but I might also want to store the versioned build output somewhere too.

    Much depends on your approach to release management.