is there anyway to import only selected components?



  • Hi,

    this is awesome framework but one problem here.

    i want to import selected components only due to reduce some file size.

    for example, if we only need Layout and Buttons so why we should get import all components by default who we are not using.

    is there any solution?


  • Admin

    @AhsanAbrar One step at a time. This is in the roadmap since we jumped to Webpack 2 which has tree-shaking: https://github.com/quasarframework/quasar/projects/3 (Miscellaneous section)

    Next Quasar version will allow apps to be 44kB smaller due to Velocity not being needed anymore.



  • @rstoenescu The combination of Vue.use( Quasar ) and WebPack2 seems like working against each other, I mean …

    If all components are registered into Vue core as global components, then WebPack2 can shake all the tree’s it likes to, these components will not be seen as dead leaves, as noone can check if they have been used inside some templates ?

    Or am I on the wrong track here ?


  • Admin

    @druppy Yeah, this will change. I haven’t said it’s ready anywhere :) I am thinking about 2 options:

    1. importing components just as you would with any Vue components. On demand, starting with root component

    2. Importing in main.js and registering them globally on Vue

    We’ll see.



  • @rstoenescu With a little luck we may get both :-)

    But the last one makes a lot of sense, I love it when things are modular, but we may change the name of the Quasar components, and then any future type definitions will then not work.



  • You know I am still learning, so go easy on me. :smile:

    importing components just as you would with any Vue components. On demand, starting with root component

    Is there any other problem with this, other than possible duplication of code for the developer? ( I think I remember you mentioning this is what is being avoided with the global implementation of components.)

    And, what if I want to introduce new components outside of the Quasar built ones? Would I have to refactor them to fit into the Quasar system, to then introduce them globally in some way?

    Scott


  • Admin

    @s.molinari Haven’t decided yet on the best way to go, so the design is in progress. No duplication will occur if we go with registering Quasar components on global Vue on main.js. Importing Quasar components works just the same as importing ANY other components. We’re using Webpack for this, so nothing specific between importing a Quasar component or other components.



  • Ok. Well, with my experience of templating systems (ala Twig and home-made systems), I’d be for declaring components locally. I personally haven’t known it any other way. :smile:

    Scott



  • @rstoenescu please can you tell me approx time when you will release stable version or webpack 2 version ?

    please tell me, actually i want to start project so i can get idea.



  • @AhsanAbrar - Quasar uses Webpack 2. And the framework is pretty stable. :smile:

    Scott


  • Admin

    @AhsanAbrar Hi, like Scott indicated, the framework is pretty stable and usable as it is now. v1.0 will only mean a few features more and (probably) some very minor API changes that will be easy to upgrade to.


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.