When we generated the template project with Yeoman’s Angular generator, it defined a few tasks for us: This part is the ‘registerTask(…)’ calls. We can call these tasks from the command line, or they can be used as dependencies (or pre-requisites) for other tasks. It defines the tasks and the dependencies between them.It calls ‘grunt.initConfig()’ to store configuration information for all the plugins and tasks that are used in the build.To actually do the initialization, ‘Grunt’ is going to call this function, passing in a reference to ‘Grunt’ itself. This function is the exported object for a module in the ‘CommonJS’ module style. ![]() '/images/'įirst, notice that although it’s a configuration file, it’s actually a JavaScript source file that defines a function. Watches files for changes and runs tasks based on the changed files Define the configuration for all the tasks Configurable paths for the applicationĪpp: require('./bower.json').appPath || 'app', Automatically load required Grunt tasks If we have a look at the first part of, we can notice a few things… //. When we run ‘grunt’, it reads a configuration file, ‘Gruntfile.js’ to find the tasks that are defined. We installed the command line tool previously (‘sudo npm install -g grunt-cli’), so the ‘grunt’ command is available in our local binary folder (this is probably ‘/usr/local/bin’, but it may vary on your system). Grunt is sort of like Apache Ant, but written in and for JavaScript. Those of you coming from a Java background are probably familiar with Apache Ant. ![]() ‘Grunt.js’, also known simply as ‘grunt’ is a task runner. ![]() Now, let’s take a look at the project that we setup. In part 1 of this article, we used Yeoman to setup a folder for a new AngularJS project. AngularJS A Build System for AngularJS applications
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |