Jade: load external javascript and call function

后端 未结 3 1877
再見小時候
再見小時候 2021-01-02 09:33

I was learning Express/Node/Jade and now in the Jade file I want to include a javascript file from the public folder just for the page. For example, in jade file I type this

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 10:17

    Or put all folders in a common folder, for example public

    public -javascripts -stylesheets -images

    and then expose that public folder

    app.use(express.static(path.join(__dirname, 'public')));

    which means you can

    script(src='/javascripts/script.js') link(rel='stylesheet', href='/stylesheets/style.css')

提交回复
热议问题