Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing RequireJS to load files that are not required else where
    primarykey
    data
    text
    <p>I'm currently building a massive web app that needs some sort of script dependancy loader. I started using RequireJS and found it's really great at optimising my code into one big JS file that loads in the correct dependancy order.</p> <p>However I have plugins - these plugins are not required anywhere because my web-app doesn't know what plugins it has in the folders. What I would like is for the grunt-contrib-requirejs process is to:</p> <p>1 - Take all my core files and load that into one file based upon their dependancies. </p> <p>2 - Then I would like it to run over my two sets of plugin folders and load those in order based upon their dependancies. </p> <p>3 - Then put those concatenated files into the first file so I have one JS file.</p> <p>I have a Less and Handlebars process that searches through each Less/CSS/Handlebars files and sorts those out and I was wondering if there's anything like that for RequireJS?</p> <p>Below is my grunt process for RequireJS:</p> <pre><code>requirejs: { compile: { options: { name: "core/js/app", baseUrl: "src", mainConfigFile: "./config.js", out: "./build/adapt/js/adapt.min.js" } } } </code></pre> <p>and here is my config.js file:</p> <pre><code>'use strict'; require.config({ deps: ['core/js/app'], paths: { jquery: 'core/js/libraries/jquery.v2', underscore: 'core/js/libraries/underscore', backbone: 'core/js/libraries/backbone', modernizr: 'core/js/libraries/modernizr', handlebars: 'core/js/libraries/handlebars', imageReady: 'core/js/libraries/imageReady', inview: 'core/js/libraries/inview', scrollTo: 'core/js/libraries/scrollTo', coreJS: 'core/js', components: 'components' }, shim: { jquery: [], backbone: { deps: ['core/js/libraries/underscore', 'core/js/libraries/jquery.v2'], exports: 'Backbone' }, underscore: { exports: '_' }, handlebars: { exports: 'Handlebars' } } }); </code></pre> <p>I do confess to being pretty new to RequireJS so would be good to get some advice of pointers to a solution. But like I said above - I need a build process that doesn't go through a JSON list, but rather search through folders after the main core is optimised in the correct order.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload