Skip to content
This repository was archived by the owner on Jan 17, 2022. It is now read-only.

[WIP] example with require-js #119

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
bower_components/
.idea/
node_modules
*.iml
*.iml
typings/
*.map
*.js
src/*.js
.tscache/
46 changes: 33 additions & 13 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,59 @@
module.exports = function(grunt) {
module.exports = function (grunt) {

grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks("grunt-tslint");
grunt.loadNpmTasks('grunt-ts');

// Project configuration.
grunt.initConfig({
connect: {
server: {
options: {
port: 8000,
base: '.',
keepalive: true
port: 8000,
base: '.',
keepalive: true
}
}
},
pkg: grunt.file.readJSON('package.json'),
ts: {
default: {
src: ["src/**/*.ts", "!node_modules/**"],
options: {
module: "amd",
moduleResolution: "node",
declaration: true,
compiler: './node_modules/typescript/bin/tsc'
},
tsconfig: 'tsconfig.json',
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n',
sourceMap: true
},
build: {
src: 'src/angular-intro.js',
src: ['src/ng-intro.component.js'],
dest: 'build/angular-intro.min.js'
}
},
jshint: {
lib: {
options: {},
src: ['src/*.js']
tslint: {
options: {
configuration: "tslint.json",
force: false,
fix: false
},
files: {
src: [
"src/ng-intro.component.ts"
]
}
},
watch: {
scripts: {
files: 'src/*.js',
tasks: ['jshint', 'uglify'],
files: 'src/*.ts',
tasks: ['ts', 'tslint', 'uglify'],
options: {
interrupt: true
}
Expand All @@ -48,8 +68,8 @@ module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);

// Default task(s).
grunt.registerTask('default', ['jshint', 'uglify']);
grunt.registerTask('default', ['ts', 'tslint', 'uglify']);

// Test
grunt.registerTask('test', ['jshint']);
grunt.registerTask('test', ['tslint']);
};
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,14 @@ alternatively as Service, [as shown here](http://plnkr.co/edit/4JdONL)

If you want to build or contribute, first, get the node modules needed (grunt, bower)

npm install
npm install
p.s.: this will run `bower install` after completes :)

Next, use bower to get the JS libraries needed

node_modules/.bin/bower install
Then, get grunt to build the typescript into .js and the minified angular-intro.min.js

Then, whenever you make any changes, get grunt to build the minified angular-intro.min.js

node_modules/.bin/grunt
node_modules/.bin/grunt watch
p.s.: for faster build use `tsc --watch`, but you need run grunt after finish

Finally, view the demo page to make sure everything's working; start a web server:

Expand All @@ -151,7 +150,6 @@ And browse to `http://localhost:8000/example/index.html`




## License

Same as intro.js, this is [AGPL](LICENSE)
4 changes: 2 additions & 2 deletions build/angular-intro.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading