SlideShare une entreprise Scribd logo
1  sur  26
IMPROVE YOUR FRONT-END
PROJECT WORKFLOW WITH GRUNT
Den Odell
Head of Web Development, AKQA
HTML Minifier
Watch
Istanbul
Uglify
JS & CSS File Concatenation

Contenu connexe

Tendances

Core web Vitals: Web Performance and Usability
Core web Vitals: Web Performance and UsabilityCore web Vitals: Web Performance and Usability
Core web Vitals: Web Performance and UsabilityIngo Steinke
 
Evolution of GitLab Frontend
Evolution of GitLab FrontendEvolution of GitLab Frontend
Evolution of GitLab FrontendFatih Acet
 
EXPERTALKS: Jul 2012 - Build using Gradle
EXPERTALKS: Jul 2012 - Build using GradleEXPERTALKS: Jul 2012 - Build using Gradle
EXPERTALKS: Jul 2012 - Build using GradleEXPERTALKS
 
Cleaning The Part: Reclaim your Logging
Cleaning The Part: Reclaim your LoggingCleaning The Part: Reclaim your Logging
Cleaning The Part: Reclaim your LoggingMatthew Campbell, OCT
 
TallyJS #1 - Intro to AngularJS
TallyJS #1 - Intro to AngularJSTallyJS #1 - Intro to AngularJS
TallyJS #1 - Intro to AngularJSAndrew Hart
 
Google Core Web Vitals - Webinar
Google Core Web Vitals - WebinarGoogle Core Web Vitals - Webinar
Google Core Web Vitals - WebinarSpike
 
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetupWordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetuprtCamp
 
Website Development Using a Headless CMS - Sean Lamacraft, Distinction
Website Development Using a Headless CMS - Sean Lamacraft, DistinctionWebsite Development Using a Headless CMS - Sean Lamacraft, Distinction
Website Development Using a Headless CMS - Sean Lamacraft, DistinctionKentico Software
 
Vered Flis: Because performance matters! Architecture Next 20
Vered Flis: Because performance matters! Architecture Next 20Vered Flis: Because performance matters! Architecture Next 20
Vered Flis: Because performance matters! Architecture Next 20CodeValue
 
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG WarsawAws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG WarsawServerless User Group Poland
 
Under the Hood with Headless WordPress and the Google Cloud Platform
Under the Hood with Headless WordPress and the Google Cloud PlatformUnder the Hood with Headless WordPress and the Google Cloud Platform
Under the Hood with Headless WordPress and the Google Cloud PlatformWP Engine
 
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS OfferingKubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS OfferingMauricio (Salaboy) Salatino
 
Better content presentation
Better content presentationBetter content presentation
Better content presentationgardenofwine
 
Better Content Presentation
Better Content PresentationBetter Content Presentation
Better Content Presentationgardenofwine
 
Steve Bailey — Core Web Vitals & Roadblocks to Success
Steve Bailey — Core Web Vitals & Roadblocks to SuccessSteve Bailey — Core Web Vitals & Roadblocks to Success
Steve Bailey — Core Web Vitals & Roadblocks to SuccessSemrush
 
Building Modular Dynamic Web Apps Ben Hale
Building Modular Dynamic Web Apps   Ben HaleBuilding Modular Dynamic Web Apps   Ben Hale
Building Modular Dynamic Web Apps Ben Halecatherinewall
 

Tendances (20)

Core web Vitals: Web Performance and Usability
Core web Vitals: Web Performance and UsabilityCore web Vitals: Web Performance and Usability
Core web Vitals: Web Performance and Usability
 
Evolution of GitLab Frontend
Evolution of GitLab FrontendEvolution of GitLab Frontend
Evolution of GitLab Frontend
 
EXPERTALKS: Jul 2012 - Build using Gradle
EXPERTALKS: Jul 2012 - Build using GradleEXPERTALKS: Jul 2012 - Build using Gradle
EXPERTALKS: Jul 2012 - Build using Gradle
 
Cleaning The Part: Reclaim your Logging
Cleaning The Part: Reclaim your LoggingCleaning The Part: Reclaim your Logging
Cleaning The Part: Reclaim your Logging
 
Building Bridges: A DevOps Story
Building Bridges:  A DevOps StoryBuilding Bridges:  A DevOps Story
Building Bridges: A DevOps Story
 
Polymer
PolymerPolymer
Polymer
 
TallyJS #1 - Intro to AngularJS
TallyJS #1 - Intro to AngularJSTallyJS #1 - Intro to AngularJS
TallyJS #1 - Intro to AngularJS
 
Google Core Web Vitals - Webinar
Google Core Web Vitals - WebinarGoogle Core Web Vitals - Webinar
Google Core Web Vitals - Webinar
 
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetupWordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
 
Website Development Using a Headless CMS - Sean Lamacraft, Distinction
Website Development Using a Headless CMS - Sean Lamacraft, DistinctionWebsite Development Using a Headless CMS - Sean Lamacraft, Distinction
Website Development Using a Headless CMS - Sean Lamacraft, Distinction
 
Vered Flis: Because performance matters! Architecture Next 20
Vered Flis: Because performance matters! Architecture Next 20Vered Flis: Because performance matters! Architecture Next 20
Vered Flis: Because performance matters! Architecture Next 20
 
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG WarsawAws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
Aws Lambda in Golang | Wojciech Barczynski | #4 Serverless UG Warsaw
 
Under the Hood with Headless WordPress and the Google Cloud Platform
Under the Hood with Headless WordPress and the Google Cloud PlatformUnder the Hood with Headless WordPress and the Google Cloud Platform
Under the Hood with Headless WordPress and the Google Cloud Platform
 
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS OfferingKubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
 
Everyday React Native
Everyday React NativeEveryday React Native
Everyday React Native
 
Web vitals
Web vitalsWeb vitals
Web vitals
 
Better content presentation
Better content presentationBetter content presentation
Better content presentation
 
Better Content Presentation
Better Content PresentationBetter Content Presentation
Better Content Presentation
 
Steve Bailey — Core Web Vitals & Roadblocks to Success
Steve Bailey — Core Web Vitals & Roadblocks to SuccessSteve Bailey — Core Web Vitals & Roadblocks to Success
Steve Bailey — Core Web Vitals & Roadblocks to Success
 
Building Modular Dynamic Web Apps Ben Hale
Building Modular Dynamic Web Apps   Ben HaleBuilding Modular Dynamic Web Apps   Ben Hale
Building Modular Dynamic Web Apps Ben Hale
 

Dernier

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Dernier (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

Improve Front-End Workflow with Grunt

Notes de l'éditeur

  1. The day-to-day workflow for web developers has remained largely unchanged for a number of years as a manual process of managing assets, writing code and then testing that code in browsers. Tools have existed for checking code quality and simplifying certain tasks, but these have been run manually and, as such, tend to get forgotten.  Here at AKQA, we’ve been simplifying our workflow and improving our code quality by harnessing the power of Grunt, the JavaScript-based task runner.
  2. - Grunt’s only dependency is Node.js - Node is a platform for running JavaScript applications on a server or command line - That means that Grunt is written entirely in JavaScript.
  3. - Programs, known as ‘packages’, are installed for Node using the Node Package Manager (npm) command-line tool. - Grunt is one such package, as are its tasks.
  4. - Before we start using Grunt itself, we need to install the Grunt Command Line Interface (CLI), which provides access to the Grunt command-line tool globally across your system. - On the command prompt, install the Grunt CLI by executing this command.
  5. Let’s imagine we have a small project we’re working on which contains a HTML file, an image, a JavaScript file and a CSS file, arranged within a project folder. - We’re going to add Grunt to our workflow for this project
  6. To enable Grunt to run against the project, we need to add two files in the project root folder: a Node package file (package.json) and a Grunt configuration file (GruntFile.js). A Node package file is a text file containing JSON-formatted project properties together with a list of node package dependencies required by the project, one of which will be Grunt in our case. -Naming this file package.json and using properties defined in the npm package file specification ( https://npmjs.org/doc/ json.html) means that the associated project can be installed together with its dependencies in a similar way to other node packages.
  7. Here we assign a human-friendly title for this Node package, a machine- friendly internal name and a version number according to the Semantic Versioning format - The latter two properties are essential for any Node package so make sure you don’t leave these out here.
  8. What’s missing now are the Node package dependencies required for our project. The most important of these to us is Grunt. - The simplest way to define a dependency and download it at the same time is to execute the following on the command line in your project directory. - Here we do that for Grunt. - The --save-dev option indicates that the package file should be updated as well as the dependency being installed locally.
  9. You’ll see all the files downloading within a new node_modules folder created within your project folder.
  10. If you open the package file again, you’ll notice the following section has been added automatically to its JSON structure. - This specifies a version number for Grunt in the project package file, so you can use different versions of Grunt for different projects.
  11. Now we’ve created our package file, if you have a new developer to introduce to your project, ask them to download Node, Grunt CLI as well as the project folder onto their machine. Next, tell the new team member to navigate to the project folder on the command line and type this command.
  12. Node will then download all the dependencies automatically according to the specific version numbers listed in the package file, and placing them within a node_modules folder for the new developer. Simple as that! - A word of advice: avoid committing this folder to source code control; let each developer download the files locally to their machine using npm and the package file.
  13. All Grunt tasks are Node packages, just like Grunt itself, so we need to specify each task as a dependency in the same way to make it available to our project. Let’s assume we want to use JSHint to perform static JavaScript code analysis on our project, checking for possible errors and enforcing a consistent set of coding conventions across all the JS files in our project for all developers working on it.
  14. This is a task perfect for Grunt, and a task called grunt-contrib-jshint exists as a Node package for us to use that does just this. - As a tip, I found a simple web search for ‘Grunt JSHint’ will locate this task for you with better certainty than the package search within the npm registry itself.
  15. Installing the grunt-contrib-jshint task and adding it as a dependency to your package file is as simple as executing the following command. - The package files will download and that’s our dependencies done. - We’re ready to move on to configure the other file - GruntFile.js.
  16. - Moving onto the Grunt configuration file, GruntFile.js - Follows the same basic structure for every project. - Use this ‘wrapper’ function, which will contain all the Grunt task settings and configuration. - module.exports property denotes that this file is in the CommonJS module format adopted by Node. Don’t worry too much about that. - However, do observe the Grunt parameter passed to the function, which is an object representing the Grunt API, containing methods and properties for working with Grunt throughout the three distinct sections of code in the rest of the file: the configuration, plug-ins and the tasks.
  17. Let’s skip the configuration section for the moment and jump ahead to the plug-ins section. - This is where we register the tasks we added as dependencies in our package file earlier to make them available to run in Grunt. - Add this line to the plug-ins section, which calls the API to register the JSHint npm task by name for use with Grunt.
  18. - According to the documentation for the JSHint plug-in, it registers a task within Grunt using the internal name jshint. This is the name we will use to refer to it from within our file. - Moving ahead once again, the tasks section of the file allows several tasks to be grouped together into a single ‘custom’ task, allowing them to be run together with a single execution of Grunt. - We register a custom task named default, which calls the JSHint task using another API call. - Extra tasks can be combined with this at a later stage by adding their internal names to the array.
  19. - The configuration section represents the individual settings required to tailor each task to perform the way we want in our project. - We add the code to the configuration section of the file, which configures the JSHint task using a call to the Grunt API. - We begin the configuration by defining a property named pkg into which we’ve loaded the properties from the package.json file as a JavaScript object. - This gives us access to the project’s internal name and version number, together with its other properties without having to duplicate them across both files. - We then add the configuration for the JSHint task within a property named after that task’s internal name. - This configuration consists of a set of options, matching those of JSHint itself, allowing the specific rules for code compliance to be set in one place for use across any specified file or files in the whole project. - Here we override JSHint’s strict option, enforcing all checked functions to adhere to ECMAScript 5’s strict mode - The remaining property, all, denotes the ‘target’ of the task (the files to run JSHint against). We’re choosing to check two files for compliance when the task runs: the configuration file itself and another file whose name is generated at runtime using the code delimited by the template strings <%= and %>. -This code uses the internal project name from the package file, which we stored in the pkg property to generate the filename dynamically as my-project.js. - Many Grunt tasks are built as ‘multi-tasks’, which means they can have multiple configurations, known as targets, for use in different circumstances. This adds a lot of power, and means that you could have a different set of rules for development on your local machine compared to those used before deployment to a live production server, for example.
  20. With our configuration in place to run JSHint across two JavaScript files, let’s run Grunt to trigger the custom task we named default. At the command prompt, execute the following command in the project root folder. Grunt actually treats this particular custom task name as the default, so we can actually run the same command without specifying the task name as an option and get the same results.
  21. - Grunt runs JSHint on the configuration file and the project JavaScript file, as requested, and outputs the results as follows. - Grunt ran the JSHint task on the configuration file first and, because that file failed to meet our code compliance rules, it stopped running at that point, ignoring any other files or tasks. The exact line number and character that caused Grunt to abort is shown in the output and allows us to pinpoint the code we need to change to enable Grunt to run successfully.
  22. Edit the configuration file and add the following line at the top of the wrapper function, enforcing ECMAScript 5 strict mode.
  23. Run Grunt again and it will output the following message. -In one shot we can ensure all our JavaScript files, even in a large project, adhere to the same rules, improving quality and code maintainability. We’ve essentially set up the beginnings of a frontend code build tool that, with some further configuration and extra tasks, could refuse to let us commit our code unless it passes strict code compliance rules. This can be automated to run as part of a deployment pipeline, ensuring only code that meets your strict quality control makes it through to your live site or web app.
  24. At AKQA, we have a Base Project Setup which includes a GruntFile and a NPM package file for allowing us to start all projects with a common foundation.
  25. We’re using some of the industry’s foremost tasks to increase our code quality and improve our development experience.