Implementing UIkit3 in Pagekit-Themes

  • Hi,

    at the moment i'm trying to create a new theme based on uikit 3. I know it's still a beta version but they told on joomla days that it can be used, because it's stable.

    Now i need to know how to implement this in my theme.

    When i do something like this

    <?php $view->script('theme', 'theme:js/theme.js', ['uikit']

    it will use pagekit's internal uikit 2. How can i now use uikit 3 in my theme, when uikit 3 was installed by npm?

    Do i have to write an additional task in my webpack.config.js to pack it in my theme.js?

  • As you wrote on Gitter you got an error like Cannot read property 'uikit' of undefined now.

    Please make sure to load jQuery as dependency. Just have a look at…odules/view/index.php#L71 .

    If this does not help, please follow this:

    On Gitter you wrote that you think that uikit is already defined in app/system/modules/view/index.php . You could try to use spqr/assets to insert uikit3 beta to your site. You could use type = URL and name the asset uikit-beta.

    This way you can figure out, whether the problem is really the usage of scripts->register('uikit', 'app/assets/uikit/js/uikit.min.js', 'jquery'); in app/system/modules/view/index.php.

  • I found the solution for my problem. You have to write following code into theme.js to get it running:

    1. (function($){
    2. $(function(){
    3. UIkit.notification('Hello world.');
    4. });
    5. })(jQuery);

    Wrapped in this construct you have access to UIkit.