2017 © Pedro Peláez
 

library webloader

Fork

image

kravcik/webloader

Fork

  • Friday, June 30, 2017
  • by kravcik
  • Repository
  • 1 Watchers
  • 0 Stars
  • 136 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 80 Forks
  • 0 Open issues
  • 16 Versions
  • 23 % Grown

The README.md

WebLoader Build Status

Component for CSS and JS files loading, (*1)

Author: Jan Marek Licence: MIT, (*2)

Example

Control factory in Nette presenter:, (*3)

<?php

protected function createComponentCss()
{
    $files = new WebLoader\FileCollection(WWW_DIR . '/css');
    $files->addFiles(array(
        'style.css',
        WWW_DIR . '/colorbox/colorbox.css',
    ));

    $files->addWatchFiles(Finder::findFiles('*.css', '*.less')->in(WWW_DIR . '/css'));

    $compiler = WebLoader\Compiler::createCssCompiler($files, WWW_DIR . '/temp');

    $compiler->addFilter(new WebLoader\Filter\VariablesFilter(array('foo' => 'bar')));
    $compiler->addFilter(function ($code) {
        return cssmin::minify($code, "remove-last-semicolon");
    });

    $control = new WebLoader\Nette\CssLoader($compiler, '/webtemp');
    $control->setMedia('screen');

    return $control;
}

Template:, (*4)

{control css}

Example with Nette Framework extension used

Configuration in app/config/config.neon:, (*5)

extensions:
    webloader: WebLoader\Nette\Extension

services:
    wlCssFilter: WebLoader\Filter\CssUrlsFilter(%wwwDir%)
    lessFilter: WebLoader\Filter\LessFilter
    jwlCssMinFilter: Joseki\Webloader\CssMinFilter

webloader:
    css:
        default:
            files:
                - style.css
                - {files: ["*.css", "*.less"], from: %appDir%/presenters} # Nette\Utils\Finder support
            filters:
                - @jwlCssMinFilter
            fileFilters:
                - @lessFilter
                - @wlCssFilter
            watchFiles:     # only watch modify file
                - {files: ["*.css", "*.less"], from: css}
                - {files: ["*.css", "*.less"], in: css}

    js:
        default:
            remoteFiles:
                - http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js
                - http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
            files:
                - %appDir%/../libs/nette/nette/client-side/netteForms.js
                - web.js

For older versions of Nette, you have to register the extension in app/bootstrap.php:, (*6)

$webloaderExtension = new \WebLoader\Nette\Extension();
$webloaderExtension->install($configurator);

Usage in app/presenters/BasePresenter.php:, (*7)

    /** @var \WebLoader\Nette\LoaderFactory @inject */
    public $webLoader;

    /** @return CssLoader */
    protected function createComponentCss()
    {
        return $this->webLoader->createCssLoader('default');
    }

    /** @return JavaScriptLoader */
    protected function createComponentJs()
    {
        return $this->webLoader->createJavaScriptLoader('default');
    }

Template:, (*8)

{control css}
{control js}

The Versions

13/10 2014

dev-nette-2.1

dev-nette-2.1 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

13/10 2014

v2.2.1

2.2.1.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

13/10 2014

dev-nette-2.0

dev-nette-2.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

13/10 2014

v2.1.2

2.1.2.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

01/01 2014

2.2.0

2.2.0.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

04/04 2013

2.1.1

2.1.1.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

25/02 2013

2.1.0

2.1.0.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

The Requires

 

The Development Requires

css javascript assets nette webloader

19/03 2012

2.0.1

2.0.1.0 http://addons.nette.org/cs/webloader

Tool for loading or deploying CSS and JS files into web pages

  Sources   Download

MIT

css javascript assets nette webloader