PHP code example of ssch / typo3-encore

1. Go to this page and download the library: Download ssch/typo3-encore library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ssch / typo3-encore example snippets


plugin.tx_typo3encore {
    settings {
        entrypointJsonPath = EXT:typo3_encore/Resources/Public/entrypoints.json
        manifestJsonPath = EXT:typo3_encore/Resources/Public/manifest.json
    }
}

   $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename'] = ''
   

    plugin.tx_typo3encore {
        settings {
            builds {
                firstBuild = EXT:typo3_encore/Resources/Public/FirstBuild
                secondBuild = EXT:typo3_encore/Resources/Public/SecondBuild
            }
        }
    }
   

ExtensionManagementUtility::addTypoScriptConstants(
    "@import 'EXT:typo3_encore/Configuration/TypoScript/constants.typoscript'
    @import 'EXT:site_package/Configuration/TypoScript/Constants/plugin.tx_typo3encore.typoscript'",
    false
);
ExtensionManagementUtility::addTypoScriptSetup(
    "@import 'EXT:typo3_encore/Configuration/TypoScript/setup.typoscript'",
    false
);

// disable CSP if "npm run watch" is used
if (strpos(file_get_contents(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/build/entrypoints.json'), 'build/vendors-node_modules') !== false) {
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['security.frontend.enforceContentSecurityPolicy'] = false;
}

page.headerData.2039 = FLUIDTEMPLATE
page.headerData.2039 {
    file = EXT:typo3_encore/Resources/Public/favicons.html
}
js
Encore
    .addStyleEntry('rte', './assets/rte.scss')