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 9061007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:22:41+00:00 2026-06-16T15:22:41+00:00

Okay, I’m going to try to simplify this example as much as possible. Here’s

  • 0

Okay, I’m going to try to simplify this example as much as possible. Here’s my problem.
I’m using node and express with jade to generate html. I have a main layout.jade file which at the end of the body contains this:

block scripts
  script(src='/javascripts/libs/jquery-1.8.1.min.js')

Then I have a jade partial (_shapes.jade) which has the following code:

block append scripts
  script(src='/javascripts/wire.js')

Then I have my jade file (properties_panel.jade) which generates the html:

extends ../layout

include _shapes

block controls
  include ../_controls

The wire.js file needs jQuery to run.
The html output from jade is exactly as I would expect it to be. I have a block of script tags at the end of the body tag, and in the correct order (jQuery first).

The problem is that jQuery is not being loaded by the browser first. BUT, then it seems to also load the file again after jQuery has loaded. I have deduced this because my wire.js file is wrapped in a self-executing anonymous function like this:

!function (context, $) {
  console.log($);
}(this, window.jQuery);

And in my console I get 2 logs. the first one says ‘undefined’ and the second one logs jQuery correctly.

So here’s the weird part though. If I comment out the script line from my _shapes.jade, and instead add it to the layout.jade file after the jQuery import line, it generates the exact same html file, but everything loads in the correct order then.

Using the chrome developer tools, I can see the load order in the resources tab and even though the html does not change at all, the load order changes depending on the way the jade file generates the same identical html.

Am I doing something wrong? I’m relatively new to jade, so I may very well be.

Thanks!

  • 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-16T15:22:42+00:00Added an answer on June 16, 2026 at 3:22 pm

    You should use ‘extends layout’ in your shape:

    extends layout
    
    block append scripts
       script(src='/javascripts/wire.js')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I know right off the bat this is going to be a stupid
Okay, Maybe this is by design of c# or maybe I am going about
Okay, this is driving me nuts. I am using canvas to draw a gauge
Okay, bear with me on this, I know it's going to look horribly convoluted,
Okay so I can't figure this out. Like a file that I using grep
Okay i have this problem with every page i make. im not sure what
Okay, so generally I wouldn't have a problem doing this and it would be
Okay this will be my last post here for today, have asked you guys
Okay this question is very simple: I have a facebook page, and a website.
Okay, I feel a bit foolish for having to ask this but I guess

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.