AngularJS Material inserts multiple (around 30) style tags with md-theme-style
attribute. I guess it's some kind of performance tuning but I would rather do it myself - I don't need an external framework to pollute my HTML in this nasty way. Any thoughts on how to get rid of the style tags?
相关问题
- angularJS: ui-router equivalent to $location.searc
- Separate AngularJS Controllers Into Separate Files
- Angular ngAnimate not working first time on page l
- Ionic Spinner not showing up
- Upload file to Google Cloud Storage using AngularJ
相关文章
- Passing variable through URL with angular js
- Watch entire object (deep watch) with AngularJS
- Angular ng-if change span text
- Can ng-show directive be used with a delay
- AngularJS $routeParams vs $stateParams
- Multiple parameters in AngularJS $resource GET
- How to set class/style of accordion heading in Ang
- PUT to S3 with presigned url gives 403 error
Direct from the angular material docs
Lazy Generate Themes
By default, every theme is generated when defined. You can disable this in the configuration section using the
$mdThemingProvider
Here's the exact syntax I used, and it worked like a champ. (Important to note this didn't break any style for us, either):
It may also be useful to know this seems to be a standard for angular. I had to turn the animations down too. By default they were animating pretty much everything.
I'm not sure if this answers the question, but to completely remove all of the
<style/>
elements from the top of the page, I did the following:and this successfully removed all the elements.
Now, when I want them generated, I call this within the main controller:
The answer is based on this question.
I do not know if it is worth the hassle. Please back-up your work, I have not tested any of this:
Angular-material includes some default theme css as a const variable in JavaScript. You can view this code in
angular-material.js
at the bottom starting with the line:When loaded into your browser this adds lots of css style tags dynamically to the page document. To disable them you will need to recompile angular-material yourself using the following commands:
Then install dependancies:
Then go to gulp/util.js and change line
53
from:to be:
Then run the build process:
This question gives more detail: How to get rid off Angular Material extra styles and CSS linked by it 'forcefully'