Reading the angular-cli documentation and some discussion on stack overflow I had understand that when a project is done with generated components, the inline styles will be all included in the build by default, but when I build my project it seems that none of the inline styles were included.
For example this component:
Component
import { MenubarService } from '../../services/menubar-service/menubar.service'
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css'],
providers:[LoginService]
})
export class LoginComponent implements OnInit {
constructor(.......
the login.component.css file is not present in the final project. I have noticed it for two reason:
First clearly the style of my app is different from the one that I have when I use 'ng serve' command and second because with the browser inspector element I don't find trace of my css.
That's my angular-cli's configuration file
{
"project": {
"version": "1.0.0-beta.18",
"name": "genioimprese"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"images",
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.css",
"paper.css"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}
except for some styles and assets it's clearly the default file of a new angular-cli projects. I think there's something wrong in my configuration file but the only documentation that I found is here, and I didn't find anything that helps me.
CSS
a{
color: #0c699e;
}
a:hover,a:active,a:focus{
color: #218fce;
}
.login{
text-align: center;
background-color: white;
height: 100%;
padding-top: 7%;
}
.login > .logo{
height: 30%;
width: 50%;
}
.input[type='text']{
background-color: grey;
color: #218fce;
border: none;
border-radius: 0;
}
h4{
color: #218fce;
}
.form-group{
margin-bottom: 10px;
}
form{
margin-bottom: 0px;
}
.checkbox-inline{
margin: 0;
}
"inline": { "style": false, "template": false },? I have not seen this before. Could it be related?ng servebuild. Could it be a caching issue which affects that styles in your prod build do get shown differently than in the dev build? Can you show some css maybe?ng build --prodis where your styles do not get displayed, right? When opening that production build in your browser, did you open the console or network tab in the dev-tools to see wether there are some issues?