jspm - How to get rid off Angular Material extra styles and CSS linked by it 'forcefully' -


  1. i using jspm/systemjs
  2. i using angular material , lib tables (which imports angular material too)
  3. i would love use sass version of angular material @import 'angular-material.scss'

but when , link compiled app.css lot angular material:

  1. i multiple <style> tags in <head> zillion of css styles (?????)
  2. i 2 <links> in <head> each import of 'angular-material.js' package systemjs (one js , 1 library - different versions)

enter image description here

that's because me , lib import js angular-material package. not asked - want app.css. so, how can rid of tags ?

i guess problem angular-material adds package.json's jspm section:

"shim": {       "angular-material": {         "deps": [           "./angular-material.css!"         ]       }     }, 

and jspm changes angular-material.js in first lines:

"format global"; "deps ./angular-material.css!"; 

i see annoying bug not feature - makes impossible use sass version , impossible correct permanently - when change in downloaded jspm package gets overwritten after update or during install (which makes impossible distribute app).

so, question - there way permanently rid off <style> , <link> tags inserted jspm/angularmaterial use sass compiled version of styling? (already forked lib , removed shim maybe there config in app allows me use 'official' version?)

this post has answer think looking for! how disable css imports in jspm / systemjs

install angular-material using jspm while overiding shim dependancies:

jspm install angular-material -o '{ shim: {} }' 

this prevents jspm adding angular-material.css dependancy. next can either re-import angular-material.scss sass file using:

@import 'jspm_packages/github/angular/bower-material@0.11.4/angular-material.scss'; 

this re-import css again, css workflow. or can re-import using jspm. first install jspm css plugin:

jspm install css 

then import css in using javascript:

import 'angular-material/angular-material.css!' import angularmaterial 'angular-material'; 

this require to compile css files using sass first. there option compile sass on fly using jspm. seems slow me:

jspm install scss=sass 

and use:

import 'angular-material/angular-material.scss!' 

update: angular-material includes default theme css const variable in javascript. can view code in angular-material.js @ bottom starting:

angular.module("material.core").constant("$md_theme_css"... 

when loaded browser adds lots of css style tags dynamically page document. disable them need recompile angular-material using following commands:

git clone https://github.com/angular/material.git 

then install dependancies:

cd material npm install 

then go gulp/util.js , change line 53 from:

var jsprocess = series(jsbuildstream, themebuildstream() ) 

to be:

var jsprocess = series(jsbuildstream) 

then run build process:

gulp build 

then copy newly created files in dist/ folder project. reduce filesizes from:

angular-material.js 842kb > 792kb angular-material.min.js 291kb > 242kb

i going request themes not included default angular-material library owner.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -