Giter Club home page Giter Club logo

c5-web-link's Introduction

ConcreteCMS WebLink

Latest Version on Packagist Software License

Manage HTML head links to improve page load performance

Installation

Include library to your composer.json

composer require xanweb/c5-web-link

Add the service provider and middleware to application/config/app.php

return [
    'providers' => [
        'xw_web_link' => '\Xanweb\C5\WebLink\ServiceProvider'
    ]
];

Make sure you are loading vendor autoload application/bootstrap/autoload.php

<?php

defined('C5_EXECUTE') or die('Access Denied.');

/*
 * ----------------------------------------------------------------------------
 * Load all composer autoload items.
 * ----------------------------------------------------------------------------
 */

// If the checker class is already provided, likely we have been included in a separate composer project
if (!class_exists(\DoctrineXml\Checker::class)) {
    // Otherwise, lets try to load composer ourselves
    if (!@include(DIR_BASE_CORE . '/' . DIRNAME_VENDOR . '/autoload.php')) {
        echo 'Third party libraries not installed. Make sure that composer has required libraries in the concrete/ directory.';
        die(1);
    }
}

if (file_exists(DIR_BASE . '/' . DIRNAME_VENDOR . '/autoload.php')) {
    include_once (DIR_BASE . '/' . DIRNAME_VENDOR . '/autoload.php');
}

Usage

    use \Fig\Link\Link;
    use \Fig\Link\Relations;

    // Example with Font Preload
    $link = (new Link(Relations::REL_PRELOAD, '/path/to/font.woff2'))
                ->withAttribute('as', 'font')
                ->withAttribute('type', 'font/woff2')
                ->withAttribute('crossorigin', 'anonymous');

    app('web/link')->queueLink($link);

c5-web-link's People

Contributors

hameddarragi avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.