Skip to content

Instantly share code, notes, and snippets.

View samueleresca's full-sized avatar

Samuele Resca samueleresca

View GitHub Profile
<!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>
//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 () {
define([], function(){
//TODO: Implements the AMD module
console.log("Module 1: loaded");
});
define(['hammer'],function(hammer){
//TODO: Implements the AMD module
console.log("Module 2: loaded");
if(hammer) console.log ("Hammer: loaded");
});
define([],function(){
//TODO: Implements the AMD module
console.log("Module 3: loaded");
});
define(<module_name>, <dependencies_array>, function(){
//Module content
})
({
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
})
node r.js -o ../scripts/build.config.js
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({
{
"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",