Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9103015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:31:41+00:00 2026-06-17T01:31:41+00:00

So I am just getting started with Yeoman. I just setup a basic project

  • 0

So I am just getting started with Yeoman. I just setup a basic project and I am not sure where to put my scripts. Should I just put stuff in the provided app.js? Or should I make my own files and add them to some build script somewhere or require them somewhere? Any advice is appreciated.

I also don’t understand the purpose of this in the app.js file:

define([], function() {
return 'Hello from Yeoman!';
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:31:43+00:00Added an answer on June 17, 2026 at 1:31 am

    Okay, so you opted to use RequireJS for your project. RequireJS allows you to break your code down in modules – not only improving the tidiness of your code (reducing spaghetti code), but also de-cluttering the global namespace.

    If you look in your main.js file, you’ll notice the following:

    require(['app'], function(app) {
      //use app here
      console.log(app);
    });
    

    What this does is include app.js into your main javascript file and runs it.

    Now, where i think you’re getting confused, is with the new syntax RequireJS introduces – but essentially each file forms a closure and has its own scope.

    Imagine the following:

    If you weren’t using RequireJs to separate your files, and all the code was in one single file. It would look like this:

    function app () {
        return 'Hello from Yeoman!';
    }
    
    console.log(app());
    

    You can write whatever you want inside app.js as long as it’s wrapped with the required RequireJS syntax:

    define([], function() {
        //Start writing your code here
    });
    

    And that’ll be included in main.js and compiled down into one file for production.

    The docs for Yeoman are a little sparse at the moment, so i’d recommend you head over to the RequireJS site and read through their documentation if you’re keen on writing modular JavaScript.

    You can always choose not to include RequireJS when initialising a new Yeoman project if you don’t want/need this functionality.

    Hope that helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting started with using json with java. I'm not sure how to
I'm just getting started with Angular.js and I'm not sure how to link two
I'm just getting started with Core Data and am not sure how this works.
Just getting started building an app using the v6 of the facebook c# sdk
Just getting started here and cannot seem to get this very basic thing working.
We're just getting started with a new project Visual Studio 2010 Team Foundation Server,
I'm just getting started in F# and have a basic question. Here's the code:
Just getting started with OpenFrameworks and I'm trying to do something that should be
I am just getting started using DotNetOpenAuth with an MVC app and I am
I'm just getting started with a basic Lua interpreter, and I've run into this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.