-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't add style elements if VIDEOJS_NO_DYNAMIC_STYLE is set to true #3093
Conversation
I'm not certain that there's a good way of doing the 3rd TODO task above. |
If you don't want Video.js to inject the base styles for you, you can disable it by setting `window.VIDEOJS_NO_BASE_THEME = true` before Video.js is loaded. | ||
Keep in mind that without these base styles enabled, you'll need to manually include them. | ||
|
||
## Default style elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section is the main addition. The rest is mostly to keep lines from getting too long in the editor.
As part of this, it means that |
It seems like if a user is setting |
@heff does that mean that we should have a different mechanism for telling videojs to not use add style elements? |
I'm saying that I think using |
@heff so, I think we should take a step back a second to talk about what we're trying to accomplish and what is happening. Hopefully, the following writeup will clear it up and we can discuss what action we should take. What is the scenario?videojs does not currently add the theme to the page by itself, a user is required to include either their own styles or the videojs styles (or both). The ProblemIn a lot of cases, these dynamically inserted style elements are causing issues. The needThere needs to be a way to make videojs not insert any style element into the DOM. This is possibly tangential to making videojs not insert a whole theme (which it doesn't do right now anyway). Current solutionThe current solution piggy backs on the previously proposed Possible requirements
I think it makes sense to have |
Ha, yeah, this is a lot to wrap your head around. I can't say I grasp on the entire issue yet, but a separate signal seems like it could make sense. Here's the earlier research that led to the default 300x150. |
Hey, would love to have this as separate flag. We use the base styling for things like the progress bar, but constrain the player ourselves with wrappers. The styles in head are requiring us to increase specificity in our code a couple of places where we would rather not. |
@videojs/core-committers I think we want to do this under a separate flag like |
I think it makes a ton of sense to not piggy-back on I agree that |
I think that the |
d2458e8
to
f0cf8b1
Compare
I think this is good to go for review by @heff and other @videojs/core-committers. |
The base Video.js skin is made using HTML and CSS (although we use the [Sass preprocessor](http://sass-lang.com)), and by default these styles are added to the dom for you! That means you can build a custom skin by simply taking advantage of the cascading aspect of CSS and overriding | ||
## Base Skin | ||
The base Video.js skin is made using HTML and CSS (although we use the [Sass preprocessor](http://sass-lang.com)), | ||
and by default these styles are added to the dom for you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like "dom" should be capitalized since it's an acronym.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should.
This is a clever way to handle it. lgtm |
Alright, this is ready for final review @heff @videojs/core-committers |
lgtm! |
Video.js does not currently include the base skin automatically yet, so, this option isn't necessary. | ||
|
||
## Default style elements | ||
Video.js uses a couple of dynamically, specifically, there's a default styles element as well as a player dimensions style element. | ||
Video.js uses a couple of style elements dynamically, specifically, there's a default styles element as well as a player dimensions style element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
styles element
=> style element
?
#donthitme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I think both are technically correct though a bit ambiguous. I was going for ((default styles) element) as opposed to a (default (style element)).
Maybe I should just change it to default styles style element
?
This fixes #3051 (and #2867) by making sure that there's a way to make videojs doesn't add style elements to the DOM. This means that it will not have any default styles like default size dimensions. It also means that if the player is configured with dimensions, they will not be applied.
That will end up looking like (assuming the videojs css is still included):
And
player.width()
andplayer.height()
will return600
and300
respectively.TODO:
base_styles.js
isn't currently wired upVIDEOJS_NO_BASE_THEME
is set totrue