Code Monkey home page Code Monkey logo

art's Introduction

AngularJS 1.4, TypeScript 1.6, RequireJS

Core concepts

  • No Controllers. Only 'Components'
  • Components declare their own HTML & CSS and support lazy-loading
  • Components can be an Angular directive
  • Components can be an Angular module, containing directives & services etc
  • Use TypeScript features as much as possible to get reasonably close to Angular2 code style
  • Support minification (of JS and CSS)
  • Support preloading concatenated CSS
  • Support preloading concatenated HTML templates

Installation

git checkout https://github.com/craigsnyders/art.git
cd art
npm install
bower install
http-server -p 8080

Note: serve the files however you like. I chose http-server

It should work from any context using relative paths, but is untested from anything except /

Building the code

# transpile typescript
tsc

# create minified .js build - includes inline CSS and HTML templates
grunt dist

How?

RequireJS concatenates and minifies the javascript

HTML templates are loaded using ngInclude which uses $http and $templateCache by default. Grunt concatenates all component HTML templates together, then requirejs injects this into the minified js build. Take a look at grunt-angular-templates and gruntfile.js to see more about this technique of inlining.

CSS loads dynamically using Angular's $http service, but it checks the $templateCache before resorting to $http. Grunt concatenates all component CSS files together using the same technique as HTML templates (grunt-angular-templates)

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.