Created
April 26, 2019 13:21
-
-
Save debabratakarfa/2c54b2db6fd20db0269ba65b93de5f18 to your computer and use it in GitHub Desktop.
admin_enqueue_scripts file not working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import external dependencies | |
import 'jquery'; | |
// Import everything from autoload | |
import './autoload/**/*' | |
// import local dependencies | |
import Router from './util/Router'; | |
import adminCommon from './routes/adminCommon'; | |
/** Populate Router instance with DOM routes */ | |
const routes = new Router({ | |
// All pages | |
adminCommon, | |
}); | |
// Load Events | |
jQuery(document).ready(() => routes.loadEvents()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
init() { | |
console.log('Admin Load'); | |
// JavaScript to be fired on all pages | |
}, | |
finalize() { | |
// JavaScript to be fired on all pages, after page specific JS is fired | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"entry": { | |
"main": [ | |
"./scripts/main.js", | |
"./styles/main.scss" | |
], | |
"admin": [ | |
"./scripts/admin.js", | |
"./styles/admin.scss" | |
], | |
"customizer": [ | |
"./scripts/customizer.js" | |
] | |
}, | |
"publicPath": "/wp-content/themes/sage-local", | |
"devUrl": "http://local.wordpress.test", | |
"proxyUrl": "http://localhost:3000", | |
"cacheBusting": "[name]_[hash:8]", | |
"watch": [ | |
"app/**/*.php", | |
"config/**/*.php", | |
"resources/views/**/*.php" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Admin assets load | |
*/ | |
add_action( 'admin_enqueue_scripts', function() { | |
wp_enqueue_style('sage/admin.css', asset_path('styles/admin.css'), false, null); | |
wp_enqueue_script('sage/admin.js', asset_path('scripts/admin.js'), ['jquery'], null, true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment