rAthus

[WordPress] force NitroPack to update custom CSS and JS files when modified

Mar 9th, 2021
508
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dans .htaccess :
  2.  
  3. # Simulation nouveaux fichiers CSS et JS pour NitroPack
  4. RewriteRule ^(.*)-(.*)-nitrokek\.(.*)$ /$1.$3 [L]
  5.  
  6. Dans functions.php :
  7.  
  8. <?php
  9.  
  10. // styles du child theme
  11. function akn_enqueue_styles() {
  12.     $ver = 'BASE';
  13.     if (file_exists(get_template_directory().'/../salient-child/style.css'))
  14.         $ver = date('YmdHis',filemtime(get_template_directory().'/../salient-child/style.css'));
  15.     wp_enqueue_style('akn-style', get_template_directory_uri().'/../salient-child/style-'.$ver.'-nitrokek.css', array(), false);
  16. }
  17. add_action('wp_enqueue_scripts', 'akn_enqueue_styles');
  18.  
  19. // javascript du child theme
  20. function akn_enqueue_scripts() {
  21.     $ver = 'BASE';
  22.     if (file_exists(get_template_directory().'/../salient-child/js/rAthus.js'))
  23.         $ver = date('YmdHis',filemtime(get_template_directory().'/../salient-child/js/rAthus.js'));
  24.     wp_enqueue_script('script-rathus', get_template_directory_uri().'/../salient-child/js/rAthus-'.$ver.'-nitrokek.js', array(), false, true);
  25. }
  26. add_action('wp_enqueue_scripts', 'akn_enqueue_scripts');
  27.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×