This repository was archived by the owner on Feb 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 56
56
}
57
57
58
58
// grab the arguments from the command line
59
- $ args = getopt ("gwcrvp " );
59
+ $ args = getopt ("gwcrvpn " );
60
60
61
61
// load Pattern Lab's config, if first time set-up move files appropriately too
62
62
$ co = new PatternLab \Configurer ;
74
74
$ g = new PatternLab \Generator ($ config );
75
75
76
76
// set some default values
77
- $ enableCSS = false ;
78
- $ moveStatic = true ;
77
+ $ enableCSS = false ;
78
+ $ moveStatic = true ;
79
+ $ noCacheBuster = false ;
79
80
80
81
// check to see if CSS for patterns should be parsed & outputted
81
82
if (isset ($ args ["c " ]) && !isset ($ args ["w " ])) {
87
88
$ moveStatic = false ;
88
89
}
89
90
90
- $ g ->generate ($ enableCSS ,$ moveStatic );
91
+ // check to see if we should turn off the cachebuster value
92
+ if (isset ($ args ["n " ])) {
93
+ $ noCacheBuster = true ;
94
+ }
95
+
96
+ $ g ->generate ($ enableCSS ,$ moveStatic ,$ noCacheBuster );
91
97
92
98
// have some fun
93
99
if (!isset ($ args ["w " ])) {
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ class Builder {
44
44
protected $ patternCSS ; // an array to hold the CSS generated for patterns
45
45
protected $ cssRuleSaver ; // where css rule saver will be initialized
46
46
protected $ cacheBuster ; // a timestamp used to bust the cache for static assets like CSS and JS
47
+ protected $ noCacheBuster ; // should we turn the cache buster on or off?
47
48
protected $ patternHead ; // the header to be included on patterns
48
49
protected $ patternFoot ; // the footer to be included on patterns
49
50
protected $ mainPageHead ; // the header to be included on main pages
@@ -390,7 +391,7 @@ protected function generateViewAllPages() {
390
391
protected function gatherData () {
391
392
392
393
// set the cacheBuster
393
- $ this ->cacheBuster = time ();
394
+ $ this ->cacheBuster = $ this -> noCacheBuster ? 0 : time ();
394
395
395
396
// gather the data from the main source data.json
396
397
if (file_exists ($ this ->sd ."/_data/_data.json " )) {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public function __construct($config = array()) {
30
30
* @param {Boolean} decide if CSS should be parsed and saved. performance hog.
31
31
* @param {Boolean} decide if static files like CSS and JS should be moved
32
32
*/
33
- public function generate ($ enableCSS = false , $ moveStatic = true ) {
33
+ public function generate ($ enableCSS = false , $ moveStatic = true , $ noCacheBuster = false ) {
34
34
35
35
$ timePL = true ; // track how long it takes to generate a PL site
36
36
@@ -41,6 +41,8 @@ public function generate($enableCSS = false, $moveStatic = true) {
41
41
$ starttime = $ mtime ;
42
42
}
43
43
44
+ $ this ->noCacheBuster = $ noCacheBuster ;
45
+
44
46
if ($ enableCSS ) {
45
47
46
48
// enable CSS globally throughout PL
You can’t perform that action at this time.
0 commit comments