https://github.com/weprovide/aviate-wordpress
Aviate implementation for WordPress
https://github.com/weprovide/aviate-wordpress
Last synced: about 1 month ago
JSON representation
Aviate implementation for WordPress
- Host: GitHub
- URL: https://github.com/weprovide/aviate-wordpress
- Owner: weprovide
- Archived: true
- Created: 2017-09-10T18:37:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T12:42:51.000Z (over 7 years ago)
- Last Synced: 2025-02-27T00:43:49.436Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Aviate WordPress
[Aviate](https://github.com/timneutkens/aviate) implementation for WordPress.
## Installation
```
composer require weprovide/aviate-wordpress
```## Usage
```js
const path = require('path')
const env = process.env.NODE_ENV || 'development'
const isDev = env === 'development'module.exports = {
distLocations: [
path.join(__dirname, 'web/app/themes/yourtheme/dist')
],
decorateConfig(config) {
config.output.publicPath = isDev ? host : './'config.entry = Object.assign({}, config.entry, {
'styles': [
path.join(__dirname, 'web/app/themes/yourtheme/assets/styles/main.scss')
],
'javascript': [
path.join(__dirname, 'web/app/themes/yourtheme/assets/javascript/main.js')
]
})return config
}
}
```## Adding custom files
`aviate.config.js`:
```js
const path = require('path')
const env = process.env.NODE_ENV || 'development'
const isDev = env === 'development'module.exports = {
distLocations: [
path.join(__dirname, 'web/app/themes/yourtheme/dist')
],
decorateConfig(config) {
config.output.publicPath = isDev ? host : './'config.entry = Object.assign({}, config.entry, {
'styles': [
path.join(__dirname, 'web/app/themes/yourtheme/assets/styles/main.scss')
],
'javascript': [
path.join(__dirname, 'web/app/themes/yourtheme/assets/javascript/main.js')
],
'your-file': [
path.join(__dirname, 'web/app/themes/yourtheme/assets/javascript/example.js')
]
})return config
}
}
````functions.php`:
```php
isDevelopment()) {
$files['js'][] = $aviate->getDevServerUrl('your-file.js');
return $files;
}$files['js'][] = $aviate->getProductionUrl('your-file.js');
return $files;
}add_filter('aviate_files', __NAMESPACE__.'\\aviateFiles', 10, 2);
```