Serving assets from Nuxt config file












0















enter image description here



I've found an online bootstrap template which I'm trying to adapt as part of a nuxt project. I've put all the bootstrap files in the static folder.



In the nuxt.config.js file:



module.exports = {
/*
** Headers of the page
*/
head: {
title: ' Bootstrap Responsive Website Template | Home :: w3layouts',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/style.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/flexslider.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/easy-responsive-tabs.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/chocolat.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/bootstrap.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/font-awesome.min.css' },
]
},


However the path is wrong and the css is not working. How can I get this working?



https://nuxtjs.org/guide/assets#static










share|improve this question























  • You should remove the 'static'. href: '/css/style.css'

    – Andrew1325
    Nov 23 '18 at 4:42











  • Your way worked!

    – user61629
    Nov 23 '18 at 14:17
















0















enter image description here



I've found an online bootstrap template which I'm trying to adapt as part of a nuxt project. I've put all the bootstrap files in the static folder.



In the nuxt.config.js file:



module.exports = {
/*
** Headers of the page
*/
head: {
title: ' Bootstrap Responsive Website Template | Home :: w3layouts',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/style.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/flexslider.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/easy-responsive-tabs.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/chocolat.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/bootstrap.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/font-awesome.min.css' },
]
},


However the path is wrong and the css is not working. How can I get this working?



https://nuxtjs.org/guide/assets#static










share|improve this question























  • You should remove the 'static'. href: '/css/style.css'

    – Andrew1325
    Nov 23 '18 at 4:42











  • Your way worked!

    – user61629
    Nov 23 '18 at 14:17














0












0








0








enter image description here



I've found an online bootstrap template which I'm trying to adapt as part of a nuxt project. I've put all the bootstrap files in the static folder.



In the nuxt.config.js file:



module.exports = {
/*
** Headers of the page
*/
head: {
title: ' Bootstrap Responsive Website Template | Home :: w3layouts',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/style.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/flexslider.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/easy-responsive-tabs.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/chocolat.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/bootstrap.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/font-awesome.min.css' },
]
},


However the path is wrong and the css is not working. How can I get this working?



https://nuxtjs.org/guide/assets#static










share|improve this question














enter image description here



I've found an online bootstrap template which I'm trying to adapt as part of a nuxt project. I've put all the bootstrap files in the static folder.



In the nuxt.config.js file:



module.exports = {
/*
** Headers of the page
*/
head: {
title: ' Bootstrap Responsive Website Template | Home :: w3layouts',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/style.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/flexslider.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/easy-responsive-tabs.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/chocolat.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/bootstrap.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/static/css/font-awesome.min.css' },
]
},


However the path is wrong and the css is not working. How can I get this working?



https://nuxtjs.org/guide/assets#static







javascript vue.js nuxt






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 3:20









user61629user61629

8,93035131264




8,93035131264













  • You should remove the 'static'. href: '/css/style.css'

    – Andrew1325
    Nov 23 '18 at 4:42











  • Your way worked!

    – user61629
    Nov 23 '18 at 14:17



















  • You should remove the 'static'. href: '/css/style.css'

    – Andrew1325
    Nov 23 '18 at 4:42











  • Your way worked!

    – user61629
    Nov 23 '18 at 14:17

















You should remove the 'static'. href: '/css/style.css'

– Andrew1325
Nov 23 '18 at 4:42





You should remove the 'static'. href: '/css/style.css'

– Andrew1325
Nov 23 '18 at 4:42













Your way worked!

– user61629
Nov 23 '18 at 14:17





Your way worked!

– user61629
Nov 23 '18 at 14:17












1 Answer
1






active

oldest

votes


















1














CSS has its own Property in the Nuxt Config.
https://nuxtjs.org/api/configuration-css/



header stuff....
css: [
{ '/css/style.css' },
{ '/css/flexslider.css' },
{ '/css/easy-responsive-tabs.css' },
{ '/css/chocolat.css' },
{ '/css/bootstrap.min.css' },
{ '/css/font-awesome.min.css' },
]


The CSS property is NOT in the header itself, it has its own point.



Note that in Nuxt the Standard Path for the Static Folder is a simple / if that doesn´t work you can also try out @/static/...






share|improve this answer
























  • Thanks for your answer. I actually used the approach from the comment above.

    – user61629
    Nov 23 '18 at 14:18











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440277%2fserving-assets-from-nuxt-config-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














CSS has its own Property in the Nuxt Config.
https://nuxtjs.org/api/configuration-css/



header stuff....
css: [
{ '/css/style.css' },
{ '/css/flexslider.css' },
{ '/css/easy-responsive-tabs.css' },
{ '/css/chocolat.css' },
{ '/css/bootstrap.min.css' },
{ '/css/font-awesome.min.css' },
]


The CSS property is NOT in the header itself, it has its own point.



Note that in Nuxt the Standard Path for the Static Folder is a simple / if that doesn´t work you can also try out @/static/...






share|improve this answer
























  • Thanks for your answer. I actually used the approach from the comment above.

    – user61629
    Nov 23 '18 at 14:18
















1














CSS has its own Property in the Nuxt Config.
https://nuxtjs.org/api/configuration-css/



header stuff....
css: [
{ '/css/style.css' },
{ '/css/flexslider.css' },
{ '/css/easy-responsive-tabs.css' },
{ '/css/chocolat.css' },
{ '/css/bootstrap.min.css' },
{ '/css/font-awesome.min.css' },
]


The CSS property is NOT in the header itself, it has its own point.



Note that in Nuxt the Standard Path for the Static Folder is a simple / if that doesn´t work you can also try out @/static/...






share|improve this answer
























  • Thanks for your answer. I actually used the approach from the comment above.

    – user61629
    Nov 23 '18 at 14:18














1












1








1







CSS has its own Property in the Nuxt Config.
https://nuxtjs.org/api/configuration-css/



header stuff....
css: [
{ '/css/style.css' },
{ '/css/flexslider.css' },
{ '/css/easy-responsive-tabs.css' },
{ '/css/chocolat.css' },
{ '/css/bootstrap.min.css' },
{ '/css/font-awesome.min.css' },
]


The CSS property is NOT in the header itself, it has its own point.



Note that in Nuxt the Standard Path for the Static Folder is a simple / if that doesn´t work you can also try out @/static/...






share|improve this answer













CSS has its own Property in the Nuxt Config.
https://nuxtjs.org/api/configuration-css/



header stuff....
css: [
{ '/css/style.css' },
{ '/css/flexslider.css' },
{ '/css/easy-responsive-tabs.css' },
{ '/css/chocolat.css' },
{ '/css/bootstrap.min.css' },
{ '/css/font-awesome.min.css' },
]


The CSS property is NOT in the header itself, it has its own point.



Note that in Nuxt the Standard Path for the Static Folder is a simple / if that doesn´t work you can also try out @/static/...







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 8:05









BadgyBadgy

1,074320




1,074320













  • Thanks for your answer. I actually used the approach from the comment above.

    – user61629
    Nov 23 '18 at 14:18



















  • Thanks for your answer. I actually used the approach from the comment above.

    – user61629
    Nov 23 '18 at 14:18

















Thanks for your answer. I actually used the approach from the comment above.

– user61629
Nov 23 '18 at 14:18





Thanks for your answer. I actually used the approach from the comment above.

– user61629
Nov 23 '18 at 14:18


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440277%2fserving-assets-from-nuxt-config-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen