All Projects → aelvan → Inlin-Craft

aelvan / Inlin-Craft

Licence: MIT license
Plugin for inlining files in templates.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Inlin-Craft

Stamp-Craft
Plugin for adding timestamp to filenames.
Stars: ✭ 28 (-56.25%)
Mutual labels:  craftcms, craftcms-plugin, craft3, craft2
craft-commerce-widgets
Insightful widgets for Craft CMS Commerce stores
Stars: ✭ 33 (-48.44%)
Mutual labels:  craftcms, craftcms-plugin, craft3, craft2
craft3-collections
Clean up those complex templates with Laravel Collections
Stars: ✭ 24 (-62.5%)
Mutual labels:  craftcms, craftcms-plugin, craft3
tablemaker
A user-definable table field type for Craft CMS
Stars: ✭ 39 (-39.06%)
Mutual labels:  craftcms, craftcms-plugin, craft3
craft-audit
Audit log for Craft 3
Stars: ✭ 18 (-71.87%)
Mutual labels:  craftcms, craftcms-plugin, craft3
store-hours
Manage business hours with Craft CMS.
Stars: ✭ 60 (-6.25%)
Mutual labels:  craftcms, craft3, craft2
craft3-fallback-site
Failing requests in a multi-site install can fall back to other sites, to prevent 404 errors from missing or disabled entries.
Stars: ✭ 14 (-78.12%)
Mutual labels:  craftcms, craftcms-plugin, craft3
craft-entry-instructions
A simple fieldtype to add instructions.
Stars: ✭ 16 (-75%)
Mutual labels:  craftcms, craftcms-plugin, craft3
anchors
Add anchor links to headings in your Craft CMS website content.
Stars: ✭ 47 (-26.56%)
Mutual labels:  craftcms, craft3, craft2
molecule
⚛️ Grab Twig components, CSS and JS files outside the primary template folder
Stars: ✭ 20 (-68.75%)
Mutual labels:  craftcms, craftcms-plugin, craft3
visor
🕶 A simple admin overlay to get to the relevant areas of the Craft CMS control panel.
Stars: ✭ 25 (-60.94%)
Mutual labels:  craftcms, craftcms-plugin, craft3
craft-router
A Craft CMS plugin for using URL segments as filtering criteria on an entry query.
Stars: ✭ 21 (-67.19%)
Mutual labels:  craftcms, craft3, craft2
VarnishPurge-Craft
Craft plugin for purging Varnish when elements are saved.
Stars: ✭ 33 (-48.44%)
Mutual labels:  craftcms, craftcms-plugin, craft2
tags
A tag manager for Craft 3
Stars: ✭ 23 (-64.06%)
Mutual labels:  craftcms, craftcms-plugin, craft3
Similar-Craft
Find similar elements
Stars: ✭ 32 (-50%)
Mutual labels:  craftcms, craftcms-plugin, craft2
craft-react
Client and Server-side React rendering for CraftCMS
Stars: ✭ 40 (-37.5%)
Mutual labels:  craftcms, craftcms-plugin, craft3
query
Run SQL queries as an admin from the Craft CMS control panel.
Stars: ✭ 14 (-78.12%)
Mutual labels:  craftcms, craft3, craft2
Form-Builder
Craft CMS plugin that lets you create and manage forms for your front-end.
Stars: ✭ 16 (-75%)
Mutual labels:  craftcms, craftcms-plugin, craft2
Spoon
Spoon plugin for Craft CMS - Enhance your Matrix fields with groups, tabs and more!
Stars: ✭ 82 (+28.13%)
Mutual labels:  craftcms, craft3
craft-assetusage
Craft plugin adds a column to see which assets are used or unused.
Stars: ✭ 28 (-56.25%)
Mutual labels:  craftcms, craftcms-plugin

Inlin for Craft

A tiny plugin for inlining files in Craft templates.

This is the Craft 3.x version of Inlin, for the Craft 2.x version see the master branch.

Requirements

This plugin requires Craft CMS 3.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require aelvan/inlin
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Inlin.

Usage

Use it like this:

{{ craft.inlin.er('/build/svg/my.svg') | raw }}

<script>{{ craft.inlin.er('/build/js/my.js') | raw }}</script>

<style type="text/css">{{ craft.inlin.er('/build/css/my.css') | raw }}</style>

Why? Sometimes it makes sense, performance or workflow wise, to inline resources instead of requesting them.

To include a remote file, pass in true as the second parameter:

{{ craft.inlin.er('http://example.com/remote/path.svg', true) | raw }}

Warning

Understand that inserting filedata in your templates, especially when passing it through Twig's raw filter, is a potential security risk. And the path is relative to your document root, so the path could point to a file anywhere on your server. Make sure you never, ever let a third party control what is inserted. In case you're thinking "meh", insert this into your template:

{{ craft.inlin.er('/../config/db.php') | raw }}

"With great power, comes great responsibility" -Voltaire

Configuration

Inlin needs to know the public document root to know where your files are located. By default Inlin will use @webroot, but on some server configurations this is not the correct path. You can configure the path by creating a config file called inline.php in your config folder, and adding the publicRoot setting.

Example

'publicRoot' => '/path/to/website/public/',
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].