VueJS - How to import import fontawesome-free 5 without vue-fontawesome?
I'm converting a project of mine from AngularJS to VueJS. I'm trying to figure out how to include @fortawesome/fontawesome-free without using vue-fontawesome. I feel that it is easier to add icons without vue-fontawesome implementation (copying and pasting directly from their site examples).
I'm having trouble importing it in my main.js. This doesn't seem to work:
#main.js
import '@fortawesome/fontawesome-free/css/all.css';
None of the icons are working. However, if I add the fontawesome 5 directly on the html page as a static, they show up. How can I use vanilla fontawesome 5 on my VueJS app?
Setup:
Symfony 4 with Encore (webpack.config.js):
var Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.addStyleEntry('css/app', './assets/css/app.css')
.addEntry('js/app', './assets/js/main.js')
.enableSassLoader()
.autoProvidejQuery()
// Enable Vue loader
.enableVueLoader()
;
module.exports = Encore.getWebpackConfig();
Here is my package.json:
{
"devDependencies": {
"@babel/core": "^7.0.0-rc.3",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0-rc.3",
"@symfony/webpack-encore": "^0.17.0",
"@vue/cli-plugin-babel": "^3.0.0-rc.3",
"babel-jest": "^23.2.0",
"babel-loader": "^8.0.2",
"less-loader": "^4.1.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"vue-loader": "^14",
"vue-template-compiler": "^2.5.17",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.5.0",
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"@fortawesome/vue-fontawesome": "^0.1.2",
"axios": "^0.18.0",
"bootstrap": "^4.1.1",
"bootstrap-vue": "^2.0.0-rc.11",
"jquery": "^3.3.1",
"npm": "^6.4.0",
"style-loader": "^0.23.1",
"sweetalert2": "^7.26.12",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"
}
}
symfony vue.js font-awesome-5
add a comment |
I'm converting a project of mine from AngularJS to VueJS. I'm trying to figure out how to include @fortawesome/fontawesome-free without using vue-fontawesome. I feel that it is easier to add icons without vue-fontawesome implementation (copying and pasting directly from their site examples).
I'm having trouble importing it in my main.js. This doesn't seem to work:
#main.js
import '@fortawesome/fontawesome-free/css/all.css';
None of the icons are working. However, if I add the fontawesome 5 directly on the html page as a static, they show up. How can I use vanilla fontawesome 5 on my VueJS app?
Setup:
Symfony 4 with Encore (webpack.config.js):
var Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.addStyleEntry('css/app', './assets/css/app.css')
.addEntry('js/app', './assets/js/main.js')
.enableSassLoader()
.autoProvidejQuery()
// Enable Vue loader
.enableVueLoader()
;
module.exports = Encore.getWebpackConfig();
Here is my package.json:
{
"devDependencies": {
"@babel/core": "^7.0.0-rc.3",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0-rc.3",
"@symfony/webpack-encore": "^0.17.0",
"@vue/cli-plugin-babel": "^3.0.0-rc.3",
"babel-jest": "^23.2.0",
"babel-loader": "^8.0.2",
"less-loader": "^4.1.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"vue-loader": "^14",
"vue-template-compiler": "^2.5.17",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.5.0",
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"@fortawesome/vue-fontawesome": "^0.1.2",
"axios": "^0.18.0",
"bootstrap": "^4.1.1",
"bootstrap-vue": "^2.0.0-rc.11",
"jquery": "^3.3.1",
"npm": "^6.4.0",
"style-loader": "^0.23.1",
"sweetalert2": "^7.26.12",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"
}
}
symfony vue.js font-awesome-5
Can you add your webpack config?
– maxpaj
Nov 23 '18 at 9:09
Done - current setup is with Symfony 4 + Encore
– Speedy059
Nov 23 '18 at 9:13
add a comment |
I'm converting a project of mine from AngularJS to VueJS. I'm trying to figure out how to include @fortawesome/fontawesome-free without using vue-fontawesome. I feel that it is easier to add icons without vue-fontawesome implementation (copying and pasting directly from their site examples).
I'm having trouble importing it in my main.js. This doesn't seem to work:
#main.js
import '@fortawesome/fontawesome-free/css/all.css';
None of the icons are working. However, if I add the fontawesome 5 directly on the html page as a static, they show up. How can I use vanilla fontawesome 5 on my VueJS app?
Setup:
Symfony 4 with Encore (webpack.config.js):
var Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.addStyleEntry('css/app', './assets/css/app.css')
.addEntry('js/app', './assets/js/main.js')
.enableSassLoader()
.autoProvidejQuery()
// Enable Vue loader
.enableVueLoader()
;
module.exports = Encore.getWebpackConfig();
Here is my package.json:
{
"devDependencies": {
"@babel/core": "^7.0.0-rc.3",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0-rc.3",
"@symfony/webpack-encore": "^0.17.0",
"@vue/cli-plugin-babel": "^3.0.0-rc.3",
"babel-jest": "^23.2.0",
"babel-loader": "^8.0.2",
"less-loader": "^4.1.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"vue-loader": "^14",
"vue-template-compiler": "^2.5.17",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.5.0",
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"@fortawesome/vue-fontawesome": "^0.1.2",
"axios": "^0.18.0",
"bootstrap": "^4.1.1",
"bootstrap-vue": "^2.0.0-rc.11",
"jquery": "^3.3.1",
"npm": "^6.4.0",
"style-loader": "^0.23.1",
"sweetalert2": "^7.26.12",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"
}
}
symfony vue.js font-awesome-5
I'm converting a project of mine from AngularJS to VueJS. I'm trying to figure out how to include @fortawesome/fontawesome-free without using vue-fontawesome. I feel that it is easier to add icons without vue-fontawesome implementation (copying and pasting directly from their site examples).
I'm having trouble importing it in my main.js. This doesn't seem to work:
#main.js
import '@fortawesome/fontawesome-free/css/all.css';
None of the icons are working. However, if I add the fontawesome 5 directly on the html page as a static, they show up. How can I use vanilla fontawesome 5 on my VueJS app?
Setup:
Symfony 4 with Encore (webpack.config.js):
var Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.addStyleEntry('css/app', './assets/css/app.css')
.addEntry('js/app', './assets/js/main.js')
.enableSassLoader()
.autoProvidejQuery()
// Enable Vue loader
.enableVueLoader()
;
module.exports = Encore.getWebpackConfig();
Here is my package.json:
{
"devDependencies": {
"@babel/core": "^7.0.0-rc.3",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0-rc.3",
"@symfony/webpack-encore": "^0.17.0",
"@vue/cli-plugin-babel": "^3.0.0-rc.3",
"babel-jest": "^23.2.0",
"babel-loader": "^8.0.2",
"less-loader": "^4.1.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"vue-loader": "^14",
"vue-template-compiler": "^2.5.17",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.5.0",
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
"@fortawesome/vue-fontawesome": "^0.1.2",
"axios": "^0.18.0",
"bootstrap": "^4.1.1",
"bootstrap-vue": "^2.0.0-rc.11",
"jquery": "^3.3.1",
"npm": "^6.4.0",
"style-loader": "^0.23.1",
"sweetalert2": "^7.26.12",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"
}
}
symfony vue.js font-awesome-5
symfony vue.js font-awesome-5
edited Nov 23 '18 at 18:02
Speedy059
asked Nov 23 '18 at 8:54
Speedy059Speedy059
1079
1079
Can you add your webpack config?
– maxpaj
Nov 23 '18 at 9:09
Done - current setup is with Symfony 4 + Encore
– Speedy059
Nov 23 '18 at 9:13
add a comment |
Can you add your webpack config?
– maxpaj
Nov 23 '18 at 9:09
Done - current setup is with Symfony 4 + Encore
– Speedy059
Nov 23 '18 at 9:13
Can you add your webpack config?
– maxpaj
Nov 23 '18 at 9:09
Can you add your webpack config?
– maxpaj
Nov 23 '18 at 9:09
Done - current setup is with Symfony 4 + Encore
– Speedy059
Nov 23 '18 at 9:13
Done - current setup is with Symfony 4 + Encore
– Speedy059
Nov 23 '18 at 9:13
add a comment |
0
active
oldest
votes
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443361%2fvuejs-how-to-import-import-fontawesome-free-5-without-vue-fontawesome%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443361%2fvuejs-how-to-import-import-fontawesome-free-5-without-vue-fontawesome%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Can you add your webpack config?
– maxpaj
Nov 23 '18 at 9:09
Done - current setup is with Symfony 4 + Encore
– Speedy059
Nov 23 '18 at 9:13