Merge pull request #83 from markcheret/cache-busting
fix: add separate prod/dev cache-busters
This commit is contained in:
commit
b14a2d80bb
5 changed files with 20 additions and 41 deletions
|
@ -12,7 +12,7 @@ cp -t dist/img img/fn-wysiwyg.png img/main-menu.png
|
||||||
echo "Copying files..."
|
echo "Copying files..."
|
||||||
cp -t dist features.txt license.txt readme.txt includes.php wpml-config.xml customized-documentation-schema.txt customized-template-stack.txt CONTRIBUTING.md README.md SECURITY.md
|
cp -t dist features.txt license.txt readme.txt includes.php wpml-config.xml customized-documentation-schema.txt customized-template-stack.txt CONTRIBUTING.md README.md SECURITY.md
|
||||||
echo "Setting production flag..."
|
echo "Setting production flag..."
|
||||||
sed "s/'C_BOOL_CSS_PRODUCTION_MODE', false/'C_BOOL_CSS_PRODUCTION_MODE', true/g" footnotes.php > dist/footnotes.php
|
sed "s/'PRODUCTION_ENV', false/'PRODUCTION_ENV', true/g" footnotes.php > dist/footnotes.php
|
||||||
echo "Production flag set."
|
echo "Production flag set."
|
||||||
|
|
||||||
# TODO: once automatic minification is implemented, this should handle that.
|
# TODO: once automatic minification is implemented, this should handle that.
|
||||||
|
|
|
@ -211,33 +211,16 @@ abstract class MCI_Footnotes_Layout_Engine {
|
||||||
* automated update of version number for cache busting.
|
* automated update of version number for cache busting.
|
||||||
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
||||||
*/
|
*/
|
||||||
if ( C_BOOL_CSS_PRODUCTION_MODE ) {
|
wp_register_style(
|
||||||
|
'mci-footnotes-admin',
|
||||||
wp_register_style(
|
plugins_url( 'footnotes/css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css' ),
|
||||||
'mci-footnotes-admin',
|
array(),
|
||||||
plugins_url( 'footnotes/css/settings.min.css' ),
|
( PRODUCTION_ENV ) ? C_STR_PACKAGE_VERSION : filemtime(
|
||||||
array(),
|
plugin_dir_path(
|
||||||
filemtime(
|
dirname( __FILE__, 2 )
|
||||||
plugin_dir_path(
|
) . 'css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css'
|
||||||
dirname( __FILE__ )
|
)
|
||||||
) . 'css/settings.min.css'
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
wp_register_style(
|
|
||||||
'mci-footnotes-admin',
|
|
||||||
plugins_url( 'footnotes/css/settings.css' ),
|
|
||||||
array(),
|
|
||||||
filemtime(
|
|
||||||
plugin_dir_path(
|
|
||||||
dirname( __FILE__, 2 )
|
|
||||||
) . 'css/settings.css'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
wp_enqueue_style( 'mci-footnotes-admin' );
|
wp_enqueue_style( 'mci-footnotes-admin' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ class MCI_Footnotes {
|
||||||
* The Boolean may be set at the bottom of the plugin’s main PHP file.
|
* The Boolean may be set at the bottom of the plugin’s main PHP file.
|
||||||
* @see footnotes.php
|
* @see footnotes.php
|
||||||
*/
|
*/
|
||||||
if ( C_BOOL_CSS_PRODUCTION_MODE ) {
|
if ( PRODUCTION_ENV ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues a minified united external stylesheet in production.
|
* Enqueues a minified united external stylesheet in production.
|
||||||
|
@ -416,11 +416,7 @@ class MCI_Footnotes {
|
||||||
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css'
|
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css'
|
||||||
),
|
),
|
||||||
array(),
|
array(),
|
||||||
filemtime(
|
C_STR_PACKAGE_VERSION,
|
||||||
plugin_dir_path(
|
|
||||||
dirname( __FILE__ )
|
|
||||||
) . 'css/footnotes-' . $l_str_tooltip_mode_short . 'ttbrpl' . $l_str_layout_mode . '.min.css'
|
|
||||||
),
|
|
||||||
'all'
|
'all'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -440,7 +436,7 @@ class MCI_Footnotes {
|
||||||
array(),
|
array(),
|
||||||
filemtime(
|
filemtime(
|
||||||
plugin_dir_path(
|
plugin_dir_path(
|
||||||
dirname( __FILE__ )
|
dirname( __FILE__, 1 )
|
||||||
) . 'css/dev-common.css'
|
) . 'css/dev-common.css'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -450,7 +446,7 @@ class MCI_Footnotes {
|
||||||
array(),
|
array(),
|
||||||
filemtime(
|
filemtime(
|
||||||
plugin_dir_path(
|
plugin_dir_path(
|
||||||
dirname( __FILE__ )
|
dirname( __FILE__, 1 )
|
||||||
) . 'css/dev-tooltips.css'
|
) . 'css/dev-tooltips.css'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -462,7 +458,7 @@ class MCI_Footnotes {
|
||||||
array(),
|
array(),
|
||||||
filemtime(
|
filemtime(
|
||||||
plugin_dir_path(
|
plugin_dir_path(
|
||||||
dirname( __FILE__ )
|
dirname( __FILE__, 1 )
|
||||||
) . 'css/dev-amp-tooltips.css'
|
) . 'css/dev-amp-tooltips.css'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -475,7 +471,7 @@ class MCI_Footnotes {
|
||||||
array(),
|
array(),
|
||||||
filemtime(
|
filemtime(
|
||||||
plugin_dir_path(
|
plugin_dir_path(
|
||||||
dirname( __FILE__ )
|
dirname( __FILE__, 1 )
|
||||||
) . 'css/dev-tooltips-alternative.css'
|
) . 'css/dev-tooltips-alternative.css'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -491,7 +487,7 @@ class MCI_Footnotes {
|
||||||
array(),
|
array(),
|
||||||
filemtime(
|
filemtime(
|
||||||
plugin_dir_path(
|
plugin_dir_path(
|
||||||
dirname( __FILE__ )
|
dirname( __FILE__, 1 )
|
||||||
) . 'css/dev-layout-' . $l_str_page_layout_option . '.css'
|
) . 'css/dev-layout-' . $l_str_page_layout_option . '.css'
|
||||||
),
|
),
|
||||||
'all'
|
'all'
|
||||||
|
|
|
@ -211,7 +211,7 @@ abstract class MCI_Footnotes_Layout_Engine {
|
||||||
* automated update of version number for cache busting.
|
* automated update of version number for cache busting.
|
||||||
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
* No need to use '-styles' in the handle, as '-css' is appended automatically.
|
||||||
*/
|
*/
|
||||||
if ( true === C_BOOL_CSS_PRODUCTION_MODE ) {
|
if ( true === PRODUCTION_ENV ) {
|
||||||
|
|
||||||
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_PACKAGE_VERSION );
|
wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_PACKAGE_VERSION );
|
||||||
|
|
||||||
|
|
|
@ -103,4 +103,4 @@ $g_obj_mci_footnotes->run();
|
||||||
* Developing stylesheets is meant to be easier when this is set to false.
|
* Developing stylesheets is meant to be easier when this is set to false.
|
||||||
* WARNING: This facility designed for development must NOT be used in production.
|
* WARNING: This facility designed for development must NOT be used in production.
|
||||||
*/
|
*/
|
||||||
define( 'C_BOOL_CSS_PRODUCTION_MODE', false );
|
define( 'PRODUCTION_ENV', false );
|
||||||
|
|
Reference in a new issue