How to remove inline CSS in nuxt 3? - css

When I build my nuxt app and then I check the source code, I noticed the CSS is written twice :
One time inline (this is the part I do not want to)
In a separated file "/_nuxt/entry.e909ad80.css" (That I want to keep)
PS : already in my nuxt.config.js
build:{
extractCSS: true
}
Is there somebody who can help ?
Thanks a lot !
Documentation : https://nuxtjs.org/docs/configuration-glossary/configuration-build/#extractcss

Related

[meteor]How to put the merged css file at the bottom of the head?

I'm using meteor + vue , but meteor automatically extracts the css, from the vue component within the npm and places it in the head, and causes the css conflict. How can this conflict be avoided?
Meteor 1.8.1
vue 2.6.5
There's a lot of css, on the page head that was originally inside vue component. I don't want that.
A lot of them, causing a lot of css conflicts on the page.
Please help me. Thank's a lot!
enter image description here
enter image description here
the <meteor-bundled-css /> flag not work
because this tag does not put the merged file at the bottom of the head. I'm so sad..
style in head
scss file not found
The correct way :
You can create  .vueignore  files with a RegEx on each line to exclude  .vue  files from the compilation based on their path. If the  .vueignore  is inside a folder, it only applies to that folder.
For example, you can add the following  .vueignore  file to your app inorder to ignore  .vue  files in the  node_modules folders:
node_modules/
Thanks for # Akryum :clap:

Rendering issue in Chrome due to #Font-Face

I have a large scale application that is developed using Angular 4, there seem's to be an rendering issue exactly as mentioned in this post Angular 2 Chrome DOM rendering problems
.When I navigate using router from one component to another
, while this question has an answer already , I am still unable to solve this issue.
My Application structure is as follows :
app-home --- > app-main --- > app-sub --- > <router-outlet> (contents)
Each of this selector imports same mixin file which is used to import #font-face , while the solution mentioned in the above mentioned post suggests to use parent component and use ViewEncapsulation.NONE , I cant do the same thing since there is a usage of the imported font face in each of these components app-home, app-main,app-sub and subsequent childs as well. When I remove the #import statement from the .less files I get an exception like
Variable #helvetica-bold is undefined
Is there a workaround to make my texts appear normally in chrome when I route from one component to another.
You need to make sure the font import is only called once.
Hence, you should remove all the font imports from the mixin file as you have already tried in your answer.
But, you also need to ensure the fonts themselves are still present once in your app where all views can access it. You probably have a file like 'app.less' or something similar, that contains styles that are available in all parts of your app. Cut the font-imports from your mixin, and instead place it in this file (make sure the path references are still valid, they might need to be adjusted). If you do not yet have such a file, you will need to create one and load it once on app start.

SASS imports breaks when using Angular Universal

Sample app available for download which shows the issue:
https://github.com/chrillewoodz/ng-boilerplate/tree/universal
I'm trying to get angular universal to work but it throws error for a SCSS import in one of the components SCSS files:
#import './src/assets/styles/utils/_exports';
It works when running it normally without universal but when it runs with universal it treats the import as relative to the component and not root.
So the path becomes:
src/app/shared/components/breadcrumbs/src/assets/styles/utils
Instead of:
src/assets/styles/utils
How can I set the path so that it works in both scenarios?
I've done some digging but unable to find similar issues, the only issues that has come up is that SASS doesn't work properly with universal and AOT. Which would be a completely separate issue once I've managed to solve this one.
you have to check from the base which is "" in tsconfig.app.json file, so the path should be relative to this "baseUrl": "", path.if you need your path as "src/assets/styles/utils" you have to change "baseUrl": "/src" of "src/assets/styles/utils".can you please share your tsconfig.app.json as asset is parallel to it or may be your folder structure.As you have to check the your SCSS file relative to asset you want to access.

Prevent ng-cli to associate css with components

I'm trying to migrate an app which was using SystemJS to ng-cli environment. I don't want to change too much the structure of the app, and beside, I dont use a css file for each component, I want to keep it global.
When I run ng serve, I get the following error :
ERROR in ./src/app/components/guest-sidebar.component.ts
Module not found: Error: Can't resolve './assets/css/guest-sidebar.css' in '/project/src/app/components'
I'm pretty new on ng-cli or webpack, how do I tell ng-cli I dont want it to associate components with their css and handle it separatly ?
Use this flag: --inline-style (alias: -is) default value: false
If you specify true then it will expect you to handle the styles "inline" and won't generate a separate css file.

Importing CSS is ending up with an error

Recently I've got in to this website, and found couple of totally cool designs, but in some of them, in the CSS part there is a snippet of code for importing like this ;
#import url(http://fonts.googleapis.com/css?family=Montserrat);
Whenever, I copy this in to my own CSS file, it ends up with an error saying ;
Imported style sheets are not checked in direct input and file upload
mode ( level 0 )
Does anyone have any idea what's the issue?
You're just trying to validate your CSS file using the W3C validator, and it's letting you know that it's not going to validate the imported style sheet (Google's). It's not an error, just some information for you.

Resources