This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Main page</title> | |
<!--REQUIRE.JS Entry Point --> | |
<script data-main="scripts/main" src="scripts/external/require.js"></script> | |
</head> | |
<body> | |
<h1>Main page</h1> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Main config file: http://requirejs.org/docs/api.html#config-baseUrl | |
require.config({ | |
//Define 3rd party plugins dependencies | |
paths: { | |
hammer: "external/hammer.min" | |
} | |
}); | |
//Main module | |
require(["module-one", "module-two", "module-three"], function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([], function(){ | |
//TODO: Implements the AMD module | |
console.log("Module 1: loaded"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['hammer'],function(hammer){ | |
//TODO: Implements the AMD module | |
console.log("Module 2: loaded"); | |
if(hammer) console.log ("Hammer: loaded"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([],function(){ | |
//TODO: Implements the AMD module | |
console.log("Module 3: loaded"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(<module_name>, <dependencies_array>, function(){ | |
//Module content | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
baseUrl: ".", //base Url | |
//Paths dependencies | |
paths: { | |
hammer: "external/hammer.min" | |
}, | |
name: "main", //the main Module | |
out: "built/main-built.js" //The complete path of build results | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node r.js -o ../scripts/build.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "blog-typescript-overview", | |
"version": "1.0.0", | |
"description": "", | |
"main": "main.ts", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Samuele Resca", | |
"license": "ISC", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
//REQUIRED MODULES | |
grunt.loadNpmTasks('grunt-typescript'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-connect'); | |
grunt.loadNpmTasks('grunt-open'); | |
//________________ | |
grunt.initConfig({ |
OlderNewer