Coder Social home page Coder Social logo

laravel-mix-components's Introduction

Laravel Mix Components

An easier way of including laravel mix in your project.

Laravel Mix Components provides components for easily connecting your laravel mix setup to your html.
Whether you run build, watch, or hot, this will read the manifest and insert the right <script> and <link> tags at the appropriate places.

Installation

$ composer require apility/laravel-mix-components

Usage

Insert the <x-mix-head /> and <x-mix-body /> blade components at the end of your <head> and <body>.

<!DOCTYPE html>
<html>
  <head>
    ...
    
    <x-mix-head />
  </head>

  <body>
    ...

    <x-mix-body />
  </body>
</html>

Configuration

Props

preload

Preloads asssets. This prop only applies to <x-mix-head />

Example
<x-mix-head preload />

integrity

Generates SRI integrity hashes for each asset. Must be a valid algorithm supportedd by PHP. Most browsers only supports sha256, sha384 and sha512.

Example
<x-mix-head integrity="sha384" />
<x-mix-body integrity="sha256,sha284" />

crossorigin

Sets the crossorigin CORS attribute. Often required by the browser if the asset is located on a different origin. If SRI is enabled, the crossorigin value must be set, otherwise the browser treats it like the integrity hash is invalid.

Example
<x-mix-head crossorigin="anonymous" />
<x-mix-body crossorigin="anonymous" />

manifest-directory

Laravel Mix will by default output the hot and mix-manifest.json files in the root of /public.
Laravel Mix Components can be configured to read the file in another directory.
The path segment given will be appended to the base directory /public.

This prop must be set on both <x-mix-head /> and <x-mix-body />.

Example
<!-- Will look for manifest files in /public/manifests -->
<x-mix-head manifest-directory="/manifests" />
<x-mix-body manifest-directory="/manifests" />

<!-- Will look for manifest files in /manifests -->
<x-mix-head manifest-directory="../manifests" />
<x-mix-body manifest-directory="../manifests" />

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.