Closed jmartsch closed 4 years ago
The issue is, that the file InlineAssets.php is not the same as https://github.com/octoper/statamic-inline-assets/blob/master/src/InlineAssets.php
The file installed via composer looks like this:
<?php
namespace Octoper\InlineAssets;
use Statamic\Tags\Tags;
class InlineAssets extends Tags
{
public function index()
{
$asset = public_path(
$this->get(['src', 'path']),
);
return file_get_contents($asset);
}
}
@jmartsch Have you updated to the latest version?
No, I just did an composer require octoper/statamic-inline-assets
, which installed Version 1. Now I see that there are newer versions. I will try these instead.
I'm closing this issue for now, If the problem still exists feel free to re-open it.
@octoper
You need to setup Composer package publishing correctly. Running composer require octoper/statamic-inline-assets
installs v1
and not the latest version.
➜ statamic git:(master) ✗ composer show octoper/statamic-inline-assets
name : octoper/statamic-inline-assets
descrip. : Inline CSS or JS file for Statamic 3
keywords :
versions : * v1
type : statamic-addon
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage :
source : [git] https://github.com/octoper/statamic-inline-assets.git 6ca54778c140040d9b0bfd4ecbd237ea3c7beb36
dist : [zip] https://api.github.com/repos/octoper/statamic-inline-assets/zipball/6ca54778c140040d9b0bfd4ecbd237ea3c7beb36 6ca54778c140040d9b0bfd4ecbd237ea3c7beb36
path : /home/vagrant/statamic/vendor/octoper/statamic-inline-assets
names : octoper/statamic-inline-assets
support
issues : https://github.com/octoper/statamic-inline-assets/issues
source : https://github.com/octoper/statamic-inline-assets/tree/master
autoload
psr-4
Octoper\InlineAssets\ => src
This is why OP and I are getting this error.
I have updated it, for me it's installing the latest version I don't know you are getting this error again and again 😬
Interestingly I can see that new versions have been published: https://repo.packagist.org/p2/octoper/statamic-inline-assets.json
I think it might be PHP version, you have specified PHP version of 7.4 or higher in composer requirements. My Homestead has PHP 7.3. Which is the same as OP.
➜ statamic git:(master) ✗ composer require octoper/statamic-inline-assets:^4.0.3
[InvalidArgumentException]
Package octoper/statamic-inline-assets at version ^4.0.3 has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version
So composer skips those versions and falls back to v1, I guess?
OK, updated to PHP 7.4 CLI (Homestead didn't have PHP 7.4 aliases mysteriously). Now without hard specifying a version, it goes for ^v4.0
.
➜ statamic git:(master) ✗ composer require octoper/statamic-inline-assets
Using version ^4.0 for octoper/statamic-inline-assets
./composer.json has been updated
Running composer update octoper/statamic-inline-assets
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
- Locking matthiasmullie/minify (1.3.66)
- Locking matthiasmullie/path-converter (1.1.3)
- Locking octoper/statamic-inline-assets (4.0.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
- Installing matthiasmullie/path-converter (1.1.3): Extracting archive
- Installing matthiasmullie/minify (1.3.66): Extracting archive
- Installing octoper/statamic-inline-assets (4.0.3): Extracting archive
I guess updating README to include PHP requirement could helpful. Or lowering the PHP requirement, do we absolutely need 7.4 in this package?
Thanks.
Description:
When I try to inline something (CSS in my case) an error is thrown:
Steps To Reproduce:
Installed the addon via composer and inserted this in my main.antlers.html file: