This fork purpose is to update webpack configuration to include custom js and scss in an enahanced setup.
- The following setup is made for scopes
html/adminhtml/defaultand a newhtml/sharedscope - new
customizefolders for custom js - new
initialize.jsscript acts as a central point to init classes made incustomizefolders initialize.jsis called inbundle.jsof their respective scope- new
html/sharedscope that is called in bothadminanddefaultscopes to house the js/scss needed to run in both admin and front applications - new
html/template/shared/assets/scss/style.scssthat is included in bothdefaultandadminstyle.scssfiles to have common styles applied in both scopes - check
webpack.config.jsto understand the setup done. - same pattern can be added to any new
themecreated in the project - new Plugin generator command class
app/Customize/Command/PluginGenerateCommand.phpto generate new plugins that follows the same setup above and give the plugins the ability to use commonJS webpack configured js classes and use scss instead of injecting js and css files directly in templates of the plugin.- The new plugin has a refactored
configentity with a new table structure for better key value config creation - new assets structure that follows the same pattern made in
htmlscope - Example Plugin include
TestPlugingenerated by the new command php bin/console app:plugin:generateapp/Plugin/TestPlugin/Resource/assets/js/admin/bundle/initializer.jsapp/Plugin/TestPlugin/Resource/assets/js/default/bundle/initializer.jsapp/Plugin/TestPlugin/Resource/assets/js/shared/bundle/initializer.js
- The new plugin has a refactored
- clone repo
- follow original project installation instructions
- install TestPlugin to see it in effect
php bin/console eccube:plugin:install --code=TestPluginphp bin/console eccube:plugin:enable --code=TestPlugin
- build assets of plugin
npm run buildor a variation of it
このフォークの目的は、Webpack の構成を更新し、カスタム JS と SCSS を拡張された構成で含めることです。
- この構成は、
html/admin、html/default、および新しく追加されたhtml/sharedスコープを対象としています。 - カスタム JS を格納するための新しい
customizeフォルダを用意。 initialize.jsスクリプトを新設し、customizeフォルダ内で作成されたクラスを初期化するための中央管理ポイントとして機能します。initialize.jsは、それぞれのスコープのbundle.js内で呼び出されます。html/sharedスコープを新設し、管理画面(admin)とフロント(default)の両方で共通して必要な JS/SCSS を格納。- 共通スタイルを適用するために、
html/template/shared/assets/scss/style.scssを新設し、adminとdefaultの両方のstyle.scssに読み込まれます。 - 構成の詳細は
webpack.config.jsを参照してください。 - この構成と同様のパターンは、プロジェクト内で作成される新しい
themeにも適用可能です。 - プラグイン生成用の新しいコマンドクラス
app/Customize/Command/PluginGenerateCommand.phpにより、上記構成を踏襲した新規プラグインを生成可能。- 生成されるプラグインは、より柔軟なキー・バリュー構成が可能なように
configエンティティが新しいテーブル構造でリファクタされています。 htmlスコープに準じた新しいアセット構成。- 例として、以下のコマンドで生成された
TestPluginが含まれます: php bin/console app:plugin:generateapp/Plugin/TestPlugin/Resource/assets/js/admin/bundle/initializer.jsapp/Plugin/TestPlugin/Resource/assets/js/default/bundle/initializer.jsapp/Plugin/TestPlugin/Resource/assets/js/shared/bundle/initializer.js
- 生成されるプラグインは、より柔軟なキー・バリュー構成が可能なように
- リポジトリをクローン
- オリジナルのプロジェクトのインストール手順に従ってください
TestPluginをインストールして、動作を確認php bin/console eccube:plugin:install --code=TestPluginphp bin/console eccube:plugin:enable --code=TestPlugin
- プラグインのアセットをビルド
npm run buildなどのコマンドを実行