F
F
firstpasha2014-05-31 18:31:01
JavaScript
firstpasha, 2014-05-31 18:31:01

Is there a sensible task of importing js files for grunt?

Who met the import task for grunt, which could build a dependency, for example, in the index.html file using the require|import statement directly in the js file.
For example:
app/scr/controller/main.js

'use strict';
//require model/Test

angular.module('testYoApp').controller('MainCtrl', function($scope) {
...
});

app/index.html
...
<!-- build:js({.tmp,app}) scripts/scripts.js -->
        <script src="src/app.js"></script>
        <script src="src/model/Test.js"></script> <!-- Вот этот добавлен автоматом -->
        <script src="src/controllers/main.js"></script>
<!-- endbuild -->
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-06-01
@firstpasha

require.js + r.js to build, or LMD, or some other dependency manager.
In general, angular supports lazy loading, so there is no need to follow the order. If you need to add all the scripts in order to save yourself from the routine, then you can simply add the scripts.forEach construction to the index.html template, and pass all available scripts there.
Also look at ngbuild

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question