GithubHelp home page GithubHelp logo

c0demark / ng-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keats/ng-boilerplate

0.0 2.0 0.0 568 KB

AngularJS boilerplate app

License: MIT License

JavaScript 35.98% TypeScript 18.98% HTML 2.75% CSS 42.28%

ng-boilerplate's Introduction

ng-boilerplate - COMPLETELY OUT OF DATE

Build Status devDependency Status

Goal

This project serves as a starting point for AngularJS projects using Typescript and SASS (it can easily be changed though).

It provides code organisation by feature (see Structure for more details) and a build system ready for development and testing.

The build system is using Gulp instead of the usual Grunt for speed and simplicity (I wrote an article introducing it with examples). The code instead of configuration approach makes it easy to modify things compared to Grunt.

So in short you get:

  • automatic SASS compilation using libsass with auto-prefixing
  • automatic DI annotation (via ng-annotate, no need for .$inject)
  • automatic typescript linting and compilation (+ concatenation and minification on dist environment)
  • automatic preload of templates using html2js (+ minification on dist environment)
  • continuous testing with karma
  • integration testing with protractor
  • exception decorator to deal with errors (in app/core/exceptions.decorator.js)
  • automatic copy of libs and assets
  • automatic injections of css/js files in index.html
  • CI setup via Travis

Install

To start your own project, you can clone that project, get rid of the history, change the git origin and start working by following the snippet below

$ git clone git://github.com/Keats/ng-boilerplate myproject
$ cd myproject
$ git checkout --orphan temp
$ git commit -m 'initial commit'
$ git branch -D master
$ git branch -m master
$ git remote remove origin
$ git remote add origin yourgitrepourl.git
$ sudo npm -g install bower
$ bower install
$ npm install
$ ./node_modules/.bin/webdriver-manager update
$ gulp

You then have 2 options: use docker or use your local installation. To get running using your local node, run the following:

$ sudo npm -g install bower gulp
$ bower install
$ npm install
$ gulp

The docker part is using docker-compose so you'll need both docker and docker-compose installed, follow these links to do so: https://docs.docker.com/installation/#installation and https://docs.docker.com/compose/#installation-and-set-up

You can just run docker-compose up and it will set up the environment in a container.

Structure

ng-boilerplate/
  |- src/
  |  |- app/
  |  |  |- <app logic>
  |  |- assets/
  |  |  |- <static files>
  |  |- style/
  |  |  |- **/*.scss
  |  |- templates/
  |  |  |- **/*.html
  |  |- tests/
  |  |  |- unit
  |  |  |  |- **/*.js
  |  |  |- integration
  |  |  |  |- **/*.js
  |  |- types/
  |  |  |  |- **/*.d.ts
  |- vendor/
  |  |- angular/
  |  |- angular-mocks/
  |  |- lodash/
  |  |- ui-router/
  |- gulpfile.js

This app organisation groups code by feature but not to the point of grouping the templates/tests/css inside it (it's really to change that in the gulpfile if you want to do that though).

Look at the home module present in the boilerplate to see how you can integrate a module in the angular app and don't forget to delete type definition for the controller in types/app/core.ts. There's also an exemple service and directive.

Tasks

This uses gulp (http://gulpjs.com/) so you can call any of the tasks defined in the gulpfile. The default one watches over the files and runs the associated tasks when needed and is called like this:

$ npm run gulp

To build the version to distribute, run the following:

$ npm run gulp build --type dist

# if you are using docker-compose, do it while container is "up"
$ docker-compose run angular gulp build --type dist

ng-boilerplate's People

Contributors

keats avatar metal3d avatar

Watchers

James Cloos avatar VIJAY KUMAR avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.