{"id":11445,"date":"2016-03-23T16:15:37","date_gmt":"2016-03-23T14:15:37","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=11445"},"modified":"2016-03-20T10:04:45","modified_gmt":"2016-03-20T08:04:45","slug":"grunt-requirejs-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/","title":{"rendered":"Grunt RequireJS Example"},"content":{"rendered":"<div class=\"toc\">\n<h3>Table Of Contents<\/h3>\n<dl>\n<dt><a href=\"#grunt\">1. Grunt<\/a><\/dt>\n<dt><a href=\"#requirejs\">2. RequireJS<\/a><\/dt>\n<dt><a href=\"#gruntrequirejs\">3. Grunt with RequireJS<\/a><\/dt>\n<dt><a href=\"#example\">4. Example<\/a><\/dt>\n<dt><a href=\"#summary\">5. Summary<\/a><\/dt>\n<dt><a href=\"#download\">6. Download<\/a><\/dt>\n<dt><a href=\"#links\">7. Links<\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"Grunt\"><\/a>1. Grunt<\/h2>\n<p>The main pre requisite that you need in order to follow this example is to have NodeJS installed in your environment. You can check the installation instructions here <a href=\"https:\/\/nodejs.org\/en\/\">https:\/\/nodejs.org\/en\/<\/a>.<\/p>\n<p>Grunt is a JavaScript based task runner. It is quite simple to use since everything is about configuring what tasks you want to execute and in what order. You can specify all these tasks in a single Grunt file configuration. One of the keys about Grunt success is its amount of available plugins (<a href=\"http:\/\/gruntjs.com\/plugins\">http:\/\/gruntjs.com\/plugins<\/a>). For more information about grunt please visit <a href=\"http:\/\/gruntjs.com\/\">http:\/\/gruntjs.com\/<\/a>.<\/p>\n<p>The first step is to install Grunt within your NodeJS installation. Here you can find the proper instructions: <a href=\"http:\/\/gruntjs.com\/getting-started\">http:\/\/gruntjs.com\/getting-started<\/a>.<\/p>\n<h2><a name=\"requirejs\"><\/a>2. RequireJS<\/h2>\n<p>RequireJS is an AMD JavaScript library that supports asynchronous file and module loading. It is optimized for web browser usage but it is also possible to use in Java or Node environments. It is compatible with all main browsers and quite intuitive to use. Its main benefit is that it offers the option to logically structure an application following the AMD principles.<\/p>\n<p>In the article <a href=\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/requirejs-tutorial-how-to-use-requirejs\/\">https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/requirejs-tutorial-how-to-use-requirejs\/<\/a> you can find more information about how to use RequireJS.<\/p>\n<h2><a name=\"gruntrequirejs\"><\/a>3. Grunt with RequireJS<\/h2>\n<p>In this example we are going to show how to create an application that uses RequireJS in combination with Grunt. We will use Grunt to download and install the needed RequireJS packages and to generate the desired deliverables.<\/p>\n<p>The first step is to install the RequireJS Grunt plugin, you can do that by typing in your NodeJS console:<\/p>\n<pre class=\"brush:bash\">npm install grunt-contrib-requirejs --save-dev\r\n<\/pre>\n<p>if you want to check that the installation has been successful, you can type:<\/p>\n<pre class=\"brush:bash\">npm ls\r\n<\/pre>\n<p>And something like the following should appear:<\/p>\n<pre class=\"brush:bash\">`-- grunt-contrib-requirejs@1.0.0\r\n  `-- requirejs@2.1.22\r\n<\/pre>\n<p>If this is the case, you are ready to go!<\/p>\n<h2><a name=\"example\"><\/a>4. Example<\/h2>\n<p>This is going to be a real life example showing a foreign exchange calculator. The application contains a home page where users enter a base and target currency and an amount and the application returns the used rate and the result applying this rate to the passed amount. The examples modules are shown here:<\/p>\n<p>HTML view:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.html<\/em><\/span><\/p>\n<pre class=\"brush:js\">\/\/check download section to see HTML code\r\n\r\n    $(\".fxcalculation\").click(function(event)\r\n    {\r\n        var fromCur = $(\".fx1\").val();\r\n        var toCur = $(\".fx2\").val();\r\n        var amountFrom = $(\".fxamount\").val();\r\n        var result = fxApp.rate(fromCur, toCur, amountFrom); \/\/created in the wrap.start snippet\r\n        $(\".fxrate\").html(result.rate);\r\n        $(\".fxresult\").html(result.total);\r\n        return false;\r\n    });\r\n\r\n\r\n<\/pre>\n<p>Main JavaScript file acting as controller:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>App.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">define([\r\n    \"jquery\",\r\n    \"fx\/DataConnector\",\r\n    \"fx\/Calculator\"\r\n], function($, DataConnector, Calculator)\r\n{\r\n    'use strict';\r\n\r\n    var fxApp = {};\r\n\r\n    \/**\r\n     * Calculates from to and puts result in a label\r\n     *\/\r\n    fxApp.rate = function()\r\n    {\r\n        var fromCur = $(\".fx1\").val();\r\n        var toCur = $(\".fx2\").val();\r\n        var amountFrom = $(\".fxamount\").val();\r\n        var fxRate = DataConnector.retrieveData(fromCur, toCur);\r\n        var amountTo = Calculator.calculate(amountFrom, fxRate);\r\n        $(\".fxrate\").html(fxRate);\r\n        $(\".fxresult\").html(amountTo);\r\n        return false;\r\n    };\r\n\r\n    return fxApp;\r\n\r\n});\r\n<\/pre>\n<p>The module bellow takes care of calculations and currency normalizations:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Calculator.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">define([], function()\r\n{\r\n    'use strict';\r\n\r\n    var calculator = {};\r\n    \/**\r\n     * very complicated calculations are part of this method\r\n     * @param amount\r\n     * @param rate\r\n     * @returns {number}\r\n     *\/\r\n    calculator.calculate = function(amount, rate)\r\n    {\r\n        return amount * rate;\r\n    };\r\n    return calculator;\r\n});\r\n<\/pre>\n<p>The following snippet shows a module taking care of the data retrieval for the foreign exchange rates:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>DataConnector.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">define([], function () {\r\n    'use strict';\r\n\r\n    var connector = {};\r\n    \/**\r\n     * data retrieval to get fx rate for a given currency pair (fake)\r\n     * @param from\r\n     * @param to\r\n     * @returns {number} fx rate\r\n     *\/\r\n    connector.retrieveData = function (from, to) {\r\n        var rate = 1;\r\n        if (\"EUR\" === from) {\r\n            if (\"USD\" === to) {\r\n                rate = 1.5;\r\n            }\r\n            else if (\"GBP\" === to) {\r\n                rate = 0.5;\r\n            } else if (\"CHF\" === to) {\r\n                rate = 0.24;\r\n            }\r\n        } else if (\"USD\" === from) {\r\n            if (\"EUR\" === to) {\r\n                rate = 0.5;\r\n            }\r\n            else if (\"GBP\" === to) {\r\n                rate = 0.25;\r\n            } else if (\"CHF\" === to) {\r\n                rate = 1.24;\r\n            }\r\n        } else if (\"GBP\" === from) {\r\n            if (\"EUR\" === to) {\r\n                rate = 1.5;\r\n            }\r\n            else if (\"USD\" === to) {\r\n                rate = 1.75;\r\n            } else if (\"CHF\" === to) {\r\n                rate = 1.33;\r\n            }\r\n        } else if (\"CHF\" === from) {\r\n            if (\"EUR\" === to) {\r\n                rate = 1.22;\r\n            }\r\n            else if (\"USD\" === to) {\r\n                rate = 3.75;\r\n            } else if (\"GBP\" === to) {\r\n                rate = 6.33;\r\n            }\r\n        }\r\n        return rate;\r\n    };\r\n    return connector;\r\n});\r\n\r\n<\/pre>\n<p>The RequireJS configuration with the used options, for a full list of options available please visit the tutorial <a href=\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/requirejs-tutorial-how-to-use-requirejs\/\">https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/requirejs-tutorial-how-to-use-requirejs\/<\/a>:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>main.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">requirejs.config({\r\n    baseUrl: 'js',\r\n    waitSeconds: 20,\r\n    paths: {\r\n        \"jquery\": \"jquery\"\r\n    },\r\n    deps: ['fx\/App'],\r\n\r\n    urlArgs: \"t=20160320000000\"\r\n});\r\n\r\n<\/pre>\n<p>And finally, the grunt file, where the configuration options are listed and the deliverables are created using the RequireJS Grunt plugin:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>gruntfile.js<\/em><\/span><\/p>\n<pre class=\"brush:js\">module.exports = function (grunt) {\r\n\r\n    \/\/ Project configuration.\r\n    grunt.initConfig({\r\n\r\n            \/\/package json containing needed Grunt plugins\r\n            pkg: grunt.file.readJSON('package.json'),\r\n\r\n            \/\/require js configuration\r\n            requirejs: {\r\n                build: {\r\n                    options: {\r\n                        baseUrl: \"js\",\r\n                        mainConfigFile: \"js\/main.js\",\r\n                        name: \"almond\", \/\/using almond plugin to generate deliverable\r\n                        include: [\"fx\/App\"],\r\n                        wrap: {\r\n                            \"startFile\": \"js\/wrap.start\", \/\/wrapping before deliverable\r\n                            \"endFile\": \"js\/wrap.end\" \/\/wrapping after deliverable\r\n                        },\r\n                        optimize: 'none', \/\/ none \/ uglify2\r\n                        \"out\": \"build\/FxCalculator.js\"\r\n                    }\r\n                }\r\n            },\r\n\r\n            \/\/small tidy up task\r\n            clean: {\r\n                start: [\r\n                    'build\/*'\r\n                ]\r\n            }\r\n        }\r\n    );\r\n\r\n    grunt.loadNpmTasks('grunt-contrib-requirejs');\r\n    grunt.loadNpmTasks('grunt-contrib-clean');\r\n\r\n    \/\/ Default task(s).\r\n    grunt.registerTask('default', [\r\n        'clean:start',\r\n        'requirejs:build'\r\n    ]);\r\n\r\n};\r\n<\/pre>\n<p>The file above uses the following package.json:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>package.json<\/em><\/span><\/p>\n<pre class=\"brush:js\">{\r\n  \"name\": \"ForeignExchangeCalc\",\r\n  \"version\": \"0.0.1\",\r\n  \"description\": \"Module for foreign exchanges calculations\",\r\n  \"dependencies\": {},\r\n  \"devDependencies\": {\r\n    \"grunt-contrib-requirejs\": \"~0.4.4\",\r\n    \"grunt-contrib-clean\": \"^0.7.0\"\r\n\r\n  },\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n  },\r\n  \"author\": \"Dani Buiza\",\r\n  \"license\": \"\"\r\n}\r\n\r\n<\/pre>\n<p>Since we are using almond.js in our configuration we put a start and end snippets around our deliverable so the module is exposed globally:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>wrap.start<\/em><\/span><\/p>\n<pre class=\"brush:js\">(function (root, factory) {\r\n    if (typeof define === 'function' &amp;&amp; define.amd) {\r\n        \/\/ AMD.\r\n        define(['jquery'], factory);\r\n    } else {\r\n        \/\/ Browser globals\r\n       root.fxApp = factory(root.$);\r\n    }\r\n}(this, function ($) {\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>wrap.end<\/em><\/span><\/p>\n<pre class=\"brush:js\">    \/\/Register in the values from the outer closure for common dependencies\r\n    \/\/as local almond modules\r\n    define('jquery', function () {\r\n        return $;\r\n    });\r\n\r\n    \/\/Use almond's special top-level, synchronous require to trigger factory\r\n    \/\/functions, get the final module value, and export it as the public\r\n    \/\/value.\r\n    return require('fx\/App');\r\n}));\r\n<\/pre>\n<p>In order to generate the desired deliverables you just need to type in (where the grunt configuration file is located):<\/p>\n<pre class=\"brush:bash\">npm install\r\n<\/pre>\n<p>in order to install all required NodeJS modules and<\/p>\n<pre class=\"brush:bash\">grunt\r\n<\/pre>\n<p>in order to generate the deliverables. At the end you can open the <code>index.html<\/code> file in a browser and see the results.<\/p>\n<h2><a name=\"summary\"><\/a>5. Summary<\/h2>\n<p>That&#8217;s it. In this example we briefly explained what Grunt and RequireJS are, we listed very useful internal and external resources and we provided a working example that shows how to deliver a RequireJS application using Grunt and the almond.js plugin.<\/p>\n<h2><a name=\"download\"><\/a>6. Download<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nIn the following link you can download a full working example covering the main components explained in this article: <strong><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/03\/requireJsGruntExample.zip\">requireJsGruntExample.zip<\/a><\/strong><\/div>\n<h2><a name=\"links\"><\/a>7. Links<\/h2>\n<p>You can find more in deep information about Grunt, RequireJS or NodeJS in the following links:<\/p>\n<ul>\n<li><a href=\"http:\/\/requirejs.org\/\">http:\/\/requirejs.org\/<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/\">https:\/\/www.npmjs.com\/\/<\/a><\/li>\n<li><a href=\"http:\/\/gruntjs.com\/\">http:\/\/gruntjs.com\/<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/grunt-contrib-requirejs\">https:\/\/www.npmjs.com\/package\/grunt-contrib-requirejs<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Table Of Contents 1. Grunt 2. RequireJS 3. Grunt with RequireJS 4. Example 5. Summary 6. Download 7. Links 1. Grunt The main pre requisite that you need in order to follow this example is to have NodeJS installed in your environment. You can check the installation instructions here https:\/\/nodejs.org\/en\/. Grunt is a JavaScript based &hellip;<\/p>\n","protected":false},"author":134,"featured_media":912,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[340],"tags":[346,45,347],"class_list":["post-11445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-requirejs","tag-amd","tag-grunt","tag-nodejs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Grunt RequireJS Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Table Of Contents 1. Grunt2. RequireJS3. Grunt with RequireJS4. Example5. Summary6. Download7. Links 1. Grunt The main pre requisite that you need in\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Grunt RequireJS Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Table Of Contents 1. Grunt2. RequireJS3. Grunt with RequireJS4. Example5. Summary6. Download7. Links 1. Grunt The main pre requisite that you need in\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-23T14:15:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Dani Buiza\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dani Buiza\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\"},\"author\":{\"name\":\"Dani Buiza\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/dedeea4946a1577492c24c5d65515504\"},\"headline\":\"Grunt RequireJS Example\",\"datePublished\":\"2016-03-23T14:15:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\"},\"wordCount\":649,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg\",\"keywords\":[\"amd\",\"Grunt\",\"nodejs\"],\"articleSection\":[\"RequireJS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\",\"name\":\"Grunt RequireJS Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg\",\"datePublished\":\"2016-03-23T14:15:37+00:00\",\"description\":\"Table Of Contents 1. Grunt2. RequireJS3. Grunt with RequireJS4. Example5. Summary6. Download7. Links 1. Grunt The main pre requisite that you need in\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"RequireJS\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/requirejs\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Grunt RequireJS Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/dedeea4946a1577492c24c5d65515504\",\"name\":\"Dani Buiza\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5ad57f031b639d68a6e473652c4907bb6ee1fd4b691e97dff4c14c6ea4d9188c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5ad57f031b639d68a6e473652c4907bb6ee1fd4b691e97dff4c14c6ea4d9188c?s=96&d=mm&r=g\",\"caption\":\"Dani Buiza\"},\"description\":\"Daniel Gutierrez Diez holds a Master in Computer Science Engineering from the University of Oviedo (Spain) and a Post Grade as Specialist in Foreign Trade from the UNED (Spain). Daniel has been working for different clients and companies in several Java projects as programmer, designer, trainer, consultant and technical lead.\",\"sameAs\":[\"http:\/\/danibuiza.github.io\/yo\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/dani-buiza\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Grunt RequireJS Example - Web Code Geeks - 2026","description":"Table Of Contents 1. Grunt2. RequireJS3. Grunt with RequireJS4. Example5. Summary6. Download7. Links 1. Grunt The main pre requisite that you need in","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/","og_locale":"en_US","og_type":"article","og_title":"Grunt RequireJS Example - Web Code Geeks - 2026","og_description":"Table Of Contents 1. Grunt2. RequireJS3. Grunt with RequireJS4. Example5. Summary6. Download7. Links 1. Grunt The main pre requisite that you need in","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2016-03-23T14:15:37+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg","type":"image\/jpeg"}],"author":"Dani Buiza","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Dani Buiza","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/"},"author":{"name":"Dani Buiza","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/dedeea4946a1577492c24c5d65515504"},"headline":"Grunt RequireJS Example","datePublished":"2016-03-23T14:15:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/"},"wordCount":649,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg","keywords":["amd","Grunt","nodejs"],"articleSection":["RequireJS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/","name":"Grunt RequireJS Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg","datePublished":"2016-03-23T14:15:37+00:00","description":"Table Of Contents 1. Grunt2. RequireJS3. Grunt with RequireJS4. Example5. Summary6. Download7. Links 1. Grunt The main pre requisite that you need in","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/gruntjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/requirejs\/grunt-requirejs-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"RequireJS","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/requirejs\/"},{"@type":"ListItem","position":4,"name":"Grunt RequireJS Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/dedeea4946a1577492c24c5d65515504","name":"Dani Buiza","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5ad57f031b639d68a6e473652c4907bb6ee1fd4b691e97dff4c14c6ea4d9188c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5ad57f031b639d68a6e473652c4907bb6ee1fd4b691e97dff4c14c6ea4d9188c?s=96&d=mm&r=g","caption":"Dani Buiza"},"description":"Daniel Gutierrez Diez holds a Master in Computer Science Engineering from the University of Oviedo (Spain) and a Post Grade as Specialist in Foreign Trade from the UNED (Spain). Daniel has been working for different clients and companies in several Java projects as programmer, designer, trainer, consultant and technical lead.","sameAs":["http:\/\/danibuiza.github.io\/yo\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/dani-buiza\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/11445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/134"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=11445"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/11445\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/912"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=11445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=11445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=11445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}