granam / web-content-builder
Builds HTML from HTML files, markdown or PHP script
Installs: 392
Dependents: 7
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- php: >=7.3
- composer-plugin-api: ^1.1|^2.0
- ext-dom: *
- ext-json: *
- erusev/parsedown: ^1.7
- granam/assets-version: ^2.0
- granam/strict-object: ^3.1
- granam/string: ^4.0
- matomo/device-detector: ^4.1
- phpgt/dom: ^2.1
Requires (Dev)
- composer/composer: ^2.0
- granam/exceptions-hierarchy: ^5.0
- granam/test-with-mockery: ^2.0
- mockery/mockery: ^1.2
- phpunit/phpunit: ^9.3
- roave/security-advisories: dev-latest
- dev-master
- 2.3.x-dev
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.x-dev
- 2.2.1
- 2.2.0
- 2.1.x-dev
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.x-dev
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.x-dev
- 1.3.1
- 1.3.0
- 1.2.x-dev
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.x-dev
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.x-dev
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-10-29 05:10:59 UTC
README
Injecting asset versions
CSS example
Example with injecting image md5 sum linked in a CSS file.
$assetsVersion = new \Granam\WebContentBuilder\AssetsVersion(); // will scan for *.css, *.html and *.md by default, /** body { background-image: url("/img/someone.jpeg"); } */ echo file_get_contents(__DIR__ . '/css/main.css'); $changedFiles = $assetsVersion->addVersionsToAssetLinks( __DIR__ /* as document root */, ['css' ]/* to document root relative dirs to scan */, []/* no dirs to exclude */, []/* no exact files to scan */, false /* no dry run to change files directly */ ); /** Array ( [0] => '/home/jaroslav/projects/granam/web-content-builder/css/main.css' ) */ print_r($changedFiles); /** body { background-image: url("/img/someone.jpeg?version=664a924915e642c7dc89af370114629a"); } */ echo file_get_contents(__DIR__ . '/css/main.css'); echo md5_file(__DIR__ . '/img/someone.jpeg'); // 664a924915e642c7dc89af370114629a