Skip to content

Commit

Permalink
Bye bye gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
kulczy committed Nov 23, 2020
1 parent a27aa47 commit c60291a
Show file tree
Hide file tree
Showing 28 changed files with 1,178 additions and 3,796 deletions.
15 changes: 0 additions & 15 deletions .babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/public/assets
/public/build
/public/css
/public/js
/public/media
Expand All @@ -14,6 +15,9 @@
/composer.lock
/node_modules

/npm-debug.log
/yarn-error.log

/etc/build/*
!/etc/build/.gitignore

Expand Down
33 changes: 33 additions & 0 deletions UPGRADE-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,36 @@
```

1. Unified API registration path in shop has been changed from `/new-api/shop/register` to `/new-api/shop/customers/`.

### From Gulp to Webpack Encore

After migrating to the Webpack, asset paths should be changed. By default, it will be compiled to the `public/build/admin/...` and `public/build/shop/...` folder:

```
- <img src="{{ asset('assets/admin/img/admin-logo.svg') }}" class="ui fluid image">
+ <img src="{{ asset('build/admin/images/admin-logo.svg', 'admin') }}" class="ui fluid image">
```

Output paths can be changed freely, but keep in mind, that before every build, the directory will be cleared, so old files may be removed.

Scripts and styles paths have also changed:

```
- {% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/admin/js/app.js'} %}
+ {{ encore_entry_script_tags('admin-entry', null, 'admin') }}
```

```
- {% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/admin/css/style.css'} %}
+ {{ encore_entry_link_tags('admin-entry', null, 'admin') }}
```

```
- {% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/shop/js/app.js'} %}
+ {{ encore_entry_script_tags('shop-entry', null, 'shop') }}
```

```
- {% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/shop/css/style.css'} %}
+ {{ encore_entry_link_tags('shop-entry', null, 'shop') }}
```
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"symfony/translation": "^4.4",
"symfony/twig-bundle": "^4.4",
"symfony/validator": "^4.4",
"symfony/webpack-encore-bundle": "^1.8",
"symfony/yaml": "^4.4",
"twig/intl-extra": "^2.12",
"twig/twig": "^2.12",
Expand Down
1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
Sonata\Doctrine\Bridge\Symfony\SonataDoctrineSymfonyBundle::class => ['all' => true],
Sonata\Twig\Bridge\Symfony\SonataTwigSymfonyBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];
7 changes: 7 additions & 0 deletions config/packages/assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
framework:
assets:
packages:
shop:
json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json'
admin:
json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json'
5 changes: 5 additions & 0 deletions config/packages/webpack_encore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
webpack_encore:
output_path: '%kernel.project_dir%/public/build/default'
builds:
shop: '%kernel.project_dir%/public/build/shop'
admin: '%kernel.project_dir%/public/build/admin'
60 changes: 0 additions & 60 deletions gulpfile.babel.js

This file was deleted.

38 changes: 5 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"dependencies": {
"babel-polyfill": "^6.26.0",
"chart.js": "^2.9.3",
"jquery": "^3.5.0",
"jquery.dirtyforms": "^2.0.0",
Expand All @@ -10,44 +9,17 @@
},
"devDependencies": {
"@symfony/webpack-encore": "^0.28.0",
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"dedent": "^0.7.0",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-import-resolver-babel-module": "^4.0.0",
"eslint-plugin-import": "^2.11.0",
"fast-async": "^6.3.7",
"gulp": "^4.0.0",
"gulp-chug": "^0.5",
"gulp-concat": "^2.6.0",
"gulp-debug": "^2.1.2",
"gulp-if": "^2.0.0",
"gulp-livereload": "^4.0.1",
"gulp-order": "^1.1.1",
"gulp-sass": "^4.0.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglifycss": "^1.0.5",
"merge-stream": "^1.0.0",
"rollup": "^0.60.2",
"rollup-plugin-babel": "^3.0.4",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-inject": "^2.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-uglify": "^4.0.0",
"sass-loader": "^7.0.1",
"upath": "^1.1.0",
"yargs": "^6.4.0"
"node-sass": "^4.5.3",
"sass-loader": "^7.0.1"
},
"scripts": {
"build": "gulp build",
"gulp": "gulp build",
"lint": "yarn lint:js",
"lint:js": "eslint gulpfile.babel.js src/Sylius/Bundle/AdminBundle/gulpfile.babel.js src/Sylius/Bundle/ShopBundle/gulpfile.babel.js src/Sylius/Bundle/UiBundle/Resources/private/js src/Sylius/Bundle/AdminBundle/Resources/private/js src/Sylius/Bundle/ShopBundle/Resources/private/js"
"dev": "encore dev",
"build": "encore production",
"watch": "encore dev --watch"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<a class="item" href="{{ path('sylius_admin_dashboard') }}" style="padding: 13px 0;">
<div style="max-width: 90px; margin: 0 auto;">
<img src="{{ asset('assets/admin/img/admin-logo.svg') }}" class="ui fluid image">
<img src="{{ asset('build/admin/images/admin-logo.svg', 'admin') }}" class="ui fluid image">
</div>
</a>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/admin/js/app.js'} %}
{{ encore_entry_script_tags('admin-entry', null, 'admin') }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/admin/css/style.css'} %}
{{ encore_entry_link_tags('admin-entry', null, 'admin') }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% include '@SyliusUi/Security/_login.html.twig' with {'action': path('sylius_admin_login_check'), 'paths': {'logo': 'assets/admin/img/logo.png'}} %}
{% include '@SyliusUi/Security/_login.html.twig' with {'action': path('sylius_admin_login_check'), 'paths': {'logo': asset('build/admin/images/logo.png', 'admin')}} %}
Loading

0 comments on commit c60291a

Please sign in to comment.