tonik / theme

Tonik is a WordPress Starter Theme which aims to modernize, organize and enhance some aspects of WordPress theme development.
http://labs.tonik.pl/theme/
MIT License
1.33k stars 140 forks source link

Move forward to use ES6 #10

Closed jedrzejchalubek closed 7 years ago

jedrzejchalubek commented 7 years ago

Import bootstrap scripts as module and compile separately with webpack.

// ./resources/assets/js/bootstrap.js
import Bootstrap from 'bootstrap-sass';

// ./gulpfile.js
mix.webpack('bootstrap.js')

Prepare resources/assets/js/theme.js boilerplate file and compile with webpack too.

// gulpfile.js
mix.webpack('theme.js')

Enqueue new files in src/Http/assets.php by default.

wp_enqueue_script('bootstrap', asset_path('js/bootstrap.js'), ['jquery'], null, true);
wp_enqueue_script('theme-scripts', asset_path('js/theme.js'), ['bootstrap'], null, true);