Coder Social home page Coder Social logo

Support composer-installer-v4 about min HOT 5 CLOSED

a-r-m-i-n avatar a-r-m-i-n commented on August 20, 2024
Support composer-installer-v4

from min.

Comments (5)

brotkrueml avatar brotkrueml commented on August 20, 2024 1

Does this hash change or is it basically an md5 hash of the path pointing to?

Yes, i think so. The path is always the same id in my tests.

The hash is derived from the relative composer path of the extension:
https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Utility/PathUtility.php#L65-L70

So, it may be, for example: /vendor/typo3/cms-core/ for $relativePrefix which is then hashed.

But beware: The vendor folder can be configured in a Project's composer.json: https://getcomposer.org/doc/06-config.md#vendor-dir
So one should not really rely on the hash in general. For one project (where this configuration is under control) it may be okay when you're knowing what you're doing.

from min.

a-r-m-i-n avatar a-r-m-i-n commented on August 20, 2024

From the README of composer-installer-v4:

The public resource URL can not be derived any more from the absolute path to the file by stripping off some path part, but only by
passing the absolute path to \TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath
Example:
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName('EXT:ext_key/Resources/Public/Icons/Extension.svg'));

Currerently I'm using substr to make the absolute server path relative. That's probably the issue.

from min.

a-r-m-i-n avatar a-r-m-i-n commented on August 20, 2024

The problem with the new assets of composer-installer v4 is, that somehow you need to resolve the hash of the asset/symlink pointing to EXT:my_ext/Resources/Public/.

In SCSS, to address font files, I need to prepend this to every font file:

$fontPath: '../../../_assets/1031f6efa8587629b685351ed90c99bf/Fonts';

Some questions I have:

  • Does this hash change or is it basically an md5 hash of the path pointing to?
  • Is there an API existing, to resolve the path to the asset?

from min.

Patta avatar Patta commented on August 20, 2024

@a-r-m-i-n

Does this hash change or is it basically an md5 hash of the path pointing to?

Yes, i think so. The path is always the same id in my tests.

Is there an API existing, to resolve the path to the asset?

TYPO3's internal resource resolver. EXT: ....

from min.

a-r-m-i-n avatar a-r-m-i-n commented on August 20, 2024

Related to #18

from min.

Related Issues (15)

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.