简体   繁体   中英

Call local Javascript files that from static directory

I'm working on a small project using Nuxt JS and I have some Javascript files that I want to call from my static directory and I don't know how can I do, for the CSS files I do :

css: [
'./static/css/theme/bootstrap.min.css',
'./static/css/theme/bootstrap_limitless.min.css',
'./static/css/theme/layout.min.css',
'./static/css/theme/components.min.css',
'./static/css/theme/colors.min.css',
'./static/css/theme/toastr.css',
'./static/css/theme/override.css',
'./static/css/theme/icons/icomoon/styles.min.css'
],

I tried the same thing with javascript using script like that :

script: [
    './static/js/test.js'
   ],

but it doesn't work since I have my test file in inside /static/js/

head: {
titleTemplate: '%s - Project name',
   meta: [...],
   link: [...],
   script: [
      { src: '/js/test.js' } // Without adding static folder
   ]
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM