Re: widgets, plone4/5 and mockup
Rok Garbas <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <20140327161442.4021.29734@oskar> |
hi kai,
i'll try to answer all of your questions but i might miss some so please ask
again. i'm aware that mockup documentation needs to be fixed and thats also one
of mine priority tasks for munich sprint which will start in few days. if you
are also coming to munich i could definetly need some help with docs and in
return you'll learn everything about mockup.
> i have some questions about mockup and plone which i really cannot
> answer on my own.
>
> First the history how i came to that questions, i try to make it short.
>
> in a plone 4.3.2 i installed plone.app.widgets 1.4.0. 1.4.0 comes with a
> select2 version wich was a little bit buggy.
> ```
> $('.content-pat-select2').select2(
> {dropdownCssClass : 'content-select2-dropdown'}
> )
> ```
> was not working. At this time a don't know much about mockup. So i
> looked in the source files of the product and searched for an unminified
> widgets.js with maybe have an unminified select2.
>
> Nothing found so why it is not there. So I got to know mockup.
>
all jquery pattern helpers are prefixed with "pattern". in case of select2
pattern that is "patternSelect2" -> $('select').patternSelect2(...) . your
above example is using select2 directly.
> Now to my stomach ache i currently have with mockup.
>
> Please correct me if i am wrong! The following should not be offensive.
> I think mockup/require.js it the right way for plone!.
>
> 1. If you use plone in business, you really will need a mockup in EVERY
> plone site i think , if you like to do deeper customizing.
> Possible reasons:
> - Fixing a java script bug in the bundle
> - Using a diffrent bootstrap version
> - Need an upgrade of jquery
> - Solving version conflicts with newly integraded stuff.
>
yes. this is the way to ensure that if you upgrade bootstrap for example wont
break some other javascript code. if we will have enough test coverage
ofcourse.
> Every released plone version has bugs. Thats reality.
>
> Something to reflect:
> Not every plone site you intall for a customer will get an upgrade if a
> new plone version will be released.
> It's every time a question of: Will he pay an upgrade. What i wan't to
> clarify here is.
> It's business as usual to fix a bug or integrate new stuff. A one time
> installed plone site can have a live time between of 4 years and more.
> I am dealing with plone since 10 years.
>
> If i understand right bower is a must have of mockup otherwise i will
> not have the js libraries. So this means every plone site will have
> round about 250 mb extra in development.
>
yes. not sure if mockup development environment is big, but it makes sense to
use tools from javascript world (node) to work with javascript.
> configure.zcml example Plone5
> ```
> <configure zcml:condition="installed mockup">
> <browser:resource
> name="plone.js"
> file="static/plone.js"
> />
> <browser:resource
> name="plone.css"
> file="static/plone.css"
> />
> </configure>
> <configure zcml:condition="not-installed mockup">
> <browser:resource
> name="plone.js"
> file="static/plone.min.js"
> />`
> <browser:resource
> name="plone.css"
> file="static/plone.min.css"
> />
> </configure>
> ```
> So if mockup is there, mockup and require js are dealing with the java
> script dependencies.
>
> If not the bundle is used. But the bundle i think is undermine what
> requirejs is. A js framework for loading js library if i really need it
> and not from the beginning on.
> But if everything is in one file, all the stuff is delivered at once.
>
i think you got it wrong here. we bundle all javascript into one file with
requirejs included. which means you can use requirejs as you would normaly.
> Here a big point. As i upgraded plone.app.widgets 1.4.0 -> 1.6.0 in
> plone4.3.2 without mockup my site breaks at first,
> because 1.4.0 is not comming with an own jquery version, 1.5.0 and
> greater does.
thats correct. we needed few versions to figured out this.
> At this time i did not reinstalled the product. I know that jquery is
> placed to deprecated, so it is not longer loaded.
> BUT: What if you don't have mockup and you install an additional add on
> product wich is build with mockup.
> You will have the same problem because jquery will be comming from a
> still existing, integrated bundle.
>
you need to compile your new bundle widget files ('make bundle-widgets') and
copy created files to plone.app.widgets static folder ('cp build/widgets*
path/to/plone/app/widgets/static') or your custom static folder which works as
a browser layer on top of plone.app.widgets layer.
> I thinks this will be a commen use case in future. An answer will be not
> depending in your add on product to jquery, you would have to depend on
> plone.
>
> But currently barceloneta, the toolbar, and widgets are referencing to
> jquery in their bundle.js.
>
> I think we really really need a way in using require js be default in
> plone. mockup installed or not. If mockup is not installed requirejs
> should works in a way wich is described on the require js page.
> Reasons:
> - For people who are not so firm with plone or new to it, it will be
> incomprehensible why they need to install a 250 mb framework only for
> fixing a java script bug.
> Or upgrading maybe select2 or using a newer bootstrap version.
fixing a python bug you also need to install quite some additional packages.
i dont see a reason why we should work with javascript in any other way. if
there is a bug write test, fix it, make sure that also doesn't break any other
tests and then compile bundle and use it in production.
upgrading select2 is actually the best example why this mockup development
environment is needed. if you upgrade select2 you might break related items
widget which is also using select2. or any other patterns that are
depending on select2. so if you do want to upgrade select2 then you also want
to run tests against all of the mockup. this is the only way to be sure that
you wont break something.
> - I think you will got massivly problems in maintenance you plone site if you
> will not install mockup in every of you sites. Fixing a js bug in core wich
> you really need to fix after maybe two or three years running the same plone
> version will consume a lot of time. And in business time is money.
you SHOULD NEVER install mockup in production. mockup is ment for development
only!
and same argument can be said for python. having old code will always be hard
to mantain be it javascript or python.
if we want stable and modern javascript stack we need to keep up with best
practices out there.
> - Because time is money in business, sometimes things has to be done
> fast and not theoretically correct. Not every project is so important
> and has a such big budget
> to do things theoretically correct.
>
> I am currenty using bootstrap in all of our new plone sites. plone
> version 4.3.2. And upgrading bootstrap in a plone site currently takes
> 15 minutes of my time.
> Downloading, extracting, uploading, commiting, checking out on server or
> egg bundled what every, restarding.
>
you just need to learn how to work with mockup. i also takes me 15min to
upgrade bootstrap. i do understand that our documentation needs to be better.
> I think makeing a version update of an js file in future has to be just
> as fast and just as easy as it is today. If everything is in a big
> compiled bundle without any separation you have no chance in doing a
> quick bug fix. And this is really really negativ. Updating jquery,
> bootstrap, awesome fonts and anything else has to possible without using
> mockup in an easy way as it is today.
>
disagree. a lot of how we work with javascript is plain WRONG! no wonder why we
ended up with such a mess.
> Plone is getting more and more complex with every version over the years.
> The greatest advantage of plone should be easy to use, easy to learn,
> fast in developement. Only with this goals new developers will get into
> the community and plone will live forever :)
>
exactly thats why we should use tools for javascript development which
javascript developers are familiar with. and sry to say but screw python
developers :)
> Thanks for your time, i hope you understand my position and my english
>
i think you missed one big advantage of mockup but that is because you are
looking from "old plone/python developer" perspective.
you know that you could now hire only js/css/html developer to work with
mockup. because to work with mockup you dont need to know NONE of python. hack
you dont even need python on your system to bootstrap mockup.
you say that all new tools will make plone complex, might be true. but tools
that we use in mockup are standard tools almost every javascript developer
uses. so for them is nothing new. but us (old python/plone farts) we need to
step up our game and learn a thing or two from javascript world if we still
want to call Plone Web CMS.
--
Rok Garbas - http://www.garbas.si
------------------------------------------------------------------------------