aelvan / inlin-craft Goto Github PK
View Code? Open in Web Editor NEWPlugin for inlining files in templates.
License: MIT License
Plugin for inlining files in templates.
License: MIT License
I run craft on an ngnix server.
When using inlin I get this error:
Neither the property "inlin" nor one of the methods "inlin()", "getinlin()"/"isinlin()" or "__call()" exist and have public access in class "Craft\CraftVariable
I aded the public path via 'inlinPublicRoot' => 'path',
but this doesn't help. Is this a ngnx issue? Or what coul be the problem?
It's be nice instead of using $_SERVER['DOCUMENT_ROOT']
it'd be nice if it defaulted to @webroot
-- and it'd also be nice if aliases could be used in the config setting inlinPublicRoot
Hi – thanks for your work on this plugin.
I think the documented usage in the README needs to be updated match the plugin behaviour. The example script usage given:
<script src="{{ craft.inlin.er('/build/svg/my.svg') | raw }}"></script>
... should actually read as follows:
<script>{{ craft.inlin.er('/build/js/script.js') | raw }}</script>
... since the plugin will just dump the contents of that file right there, it should be placed between the script
tags and not inside the src
attribute.
Thanks again.
I’m wondering if this is possible. I have a teaser block and when SVGs are added instead of bitmap images, I want them to be inlined instead of output as an image element. Inlin only offers an output tag. Is there a way to insert a field as an argument, or is that not possible with Twig?
My example $filePath ends up being 'http://localhost:8888/carbon/public/re/icons/money.svg', 'http://localhost:8888/carbon/public/' coming from 'inlinPublicRoot' and the rest being passed by $fileName. Checking file_exists($fileName) does work.
if ($fileName !== '' && file_exists($fileName)) {
I don't think file_exists()
should be getting a full url. From the docs:
file_exists — Checks whether a file or directory exists
Thanks for writing the plugin! Let me know what you think.
In my local dev environment the plugin shows up and works. But when I move it to my server it doesn't even show up, but other plugins do.
Any ideas?
Thanks for the great plugin by the way.
The example you provided to put in the config/inline.php file didn't work for me cause I figured you had to return it as an array? It error'ed in "Call to a member function setAttributes() on null"
So I declared it as a variable and then it worked out fine :) Is there something I missed or do you need to update the readme file with a variable declaration of $publicRoot instead of 'publicRoot' => 'xxx'?
I'd like to use Inlin on a client project, but the client is hesitant because the plugin has no licensing info. Would it be possible to add a license to your project?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.