Sto tentando di utilizzare cfstatic. Nel mio index.cfm, sto aggiungendo solo green.css usando cfstatic, cfstatic dovrebbe aggiungere solo la versione minimizzata di green.css, quindi il mio testo h1 <h1>I should be Green</h1>
dovrebbe essere in colore verde. Ma cfstatic sta aggiungendo sia green.css & red.css. Mi manca la configurazione?ColdFusion cfstatic include tutti i file CSS
Application.cfc
component output="false"{
This.name = "testing";
This.sessionManagement = true;
This.sessionTimeout = CreateTimeSpan(1, 23, 59, 59);
This.mappings["/org"] = expandpath('.')&'\org';
function onRequestStart(){
application.cfstatic = CreateObject('org.cfstatic.CfStatic')
.init( staticDirectory = ExpandPath('./assets'),
staticUrl = "/cfstatic/assets/"
);
}
}
index.cfm
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
<cfscript>
application.cfstatic.include('/css/green.css',true);
</cfscript>
<cfoutput>#application.cfstatic.renderIncludes('css')#</cfoutput>
</head>
<body>
<h1>I should be Green</h1>
</body>
</html>
Green.css
/* This is assets/css/green.css */
h1 {color:green;}
Red.css
/* This is assets/css/red.css */
h1 {color:red;}
La mia uscita Browser è,
Io sono l'autore e questa risposta è la risposta assolutamente corretta, quindi complimenti a Tony per aver letto i documenti e avere un esempio funzionante. I documenti potrebbero certamente essere migliori, ma leggere qui come funziona la minificazione è fondamentale: http://domwatson.codes/cfstatic/ –