Transcripción
Extracto de la transcripción automática del vídeo realizada por YouTube.
yes I'm not a front under I am much more the back end type I have been learning quickly but still will become rapidly apparent my lack of knowledge about actually doing things well so the other more serious point though is that the sands of Drupal 8 continue
to shift and I'm gonna be talking about things that we would like to bring in here but we're not exactly sure how much will make in so I'm going to try to keep it as clear as possible and towards the end I talked about the sort of three different
rough things that we could shoot for but yeah keep in mind that now this is fixed and it's especially applicable to the code which is intended to be illustrative not functional also just with the amount of things that have been shifting I mean I've
had like we write significant portions of this presentation in the last two weeks and even the last 72 hours based on conversations that I've had and is Chris wall Smith here yes no maybe so now okay awesome he's the author of ascetic and so I figured
he was going to tear me no one after works but I'll just have to meet him later cuz I believe he is here at the conference but without further ado let's talk about asset management so when i say i sent management at least for these purposes here i'm
also to be clear just talking about style sheets CSS and javascript not talking about images that is something that said it also helps us with but that's not that's not my focus so much here so with respect to asset management there are a few different
parts to it that they go into it so first is how you declare them that is how you tell the system you're operating in that they're there and in a system like drupal this is actually fairly complicated the different places you say i have this asset
the page where as in a lot of other systems it may be less complicated if you just have template files well you just write in the you writing a script tag or a link tag that says this is the asset that I want it's more complicated in Drupal how you can
write them that is do you have to just write JavaScript or CSS or can you use has compass or and never of the other interesting new ways of writing assets since right now to paint to try to do how many folks try to use coffee scripts as whatever else in Drupal
7 right now how many folks enjoy the process of trying to get it to work I have one hand up until oh you actually tried it okay good good that's nice dear well hopefully it'll be better but yeah then there's really the trickiest question in Drupal
which is how you organize them all together and we'll spend a fair bit of time on that but finally there's the question of how the browser gets them and how fast the browser gets them since of course your asset management strategy and how much you
can aggregate bundle etc has significant effects on your front performance so right now Drupal collects information in a few different ways for one there's the information you put in the theme info file says I have these assets had them please always there's
also libraries and we've moved more and more things over the libraries but inside a hook library info you declared different declare actually JavaScript and CSS together as a single library and then other systems can say I depend on on this library at
once you're the vet library and it's contained assets are brought in to the page and there's attached which is the especially for front-end folks that is show of hands who know who knows what attached is yeah since that's what I thought who
knows with red rapey is and render a race right okay so drupal's internal system for deciding what it's actually going to render we have this whole system we instituted in Drupal 7 called render API where we basically build big arrays of instructions
about things to render and it's full of lots of these pound attached values vary it's inspired by form API which is a set of instructions for how you render form well this is generalized to doing all rendering and the purpose of pound attached is to
say I have additional attached resources that should be added when this thing as being rendered and it's used to do things like say at this piece of JavaScript the CSS or also declaring that this library should be included things like that but it is as
I'll talk about more later the sort of primary base mechanism that word that we're trying to move towards and of course this trip will add CSS and reply jas I was familiar with those yeah considerably more common so those are going away that's
maybe the only thing that I can say for mostly sure is that we're trying to get rid of those but beyond that and especially when calling Drupal at CSS and do pledge a yes we have a few extra meta properties that we attach to our assets scope that they
live in Group browser information and then of course also some things like the media query to use with with style sheets is released so we have a sort of collection of things that serves the different needs and purposes we have we have themes that need to
say I have these assets there's also themes need to manipulate the other essence system there's modules which guess sometimes at least need to add their own assets and really the the purpose of the attached case though is is kind of a more sensible
one it says I'm putting some like maybe a block on the page and the block needs and CSS to go with it so we'll put out attached on block and and let it bring in its CSS so these things kind of suck because first okay who can tell me the weights of
jQuery is just offhand does anybody know what is it minus 20 yeah we use explicit waits for all of our assets is the way that we manage it you don't always see it but the when we build up the big array of all the JavaScript for all those lousy that we're
going to add to the page they each have a weight assigned to that this is how we get them out in the correct order it's kind of crazy because the way it actually works is the order in which you call Drupal add CSS like it adds just a little teensy bit
to the weight for each one thing that gets called so we really just sort of hope that everything gets called in the right order and it works out well enough most of the time but since we have explicit waiting it was a poor solution since the problem we're
trying to solve really is making sure that well if I depend on jQuery that I want to be added after jquery having a weight that makes you get added after jquery accomplishes that but it also means that there might be a whole bunch of other things that your
weighted after that you don't actually care about doesn't actually map you a bunch of unrelated javascript that is still an explicit weight ordering and ends up having significant effects on how we can do aggregation fondling so explicit weight is
a very mediocre solution global functions drupal and CSS and reply yes they are deaf to caching to good proper ability to they did not do that they are death to our ability to cache the page in a proper way mostly because you can call them from anywhere and
they change page output from anywhere and if we can't predict what the page is going to look like that we can't cash it so this is why primary reasons that we're trying to get rid of these global functions as i said before using SAS coffeescript
etc all these new systems that actually you know make you want to be a front um is awkward at best and you know folks come up with sort of one-off strategies but we don't we gotta make a systematic way of supporting this right now there's also problems
because the list of declared assets is opaque so by that I mean if you are in a theme and you're trying to look at the list of all the JavaScript or CSS it's been declared you want manipulate them in some way you have no idea if you're looking
[ ... ]
Nota: se han omitido las otras 3.936 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.