<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #2950: paster command to minify javascript and css</title>
    <link>http://localhost/ticket/2950</link>
    <description>&lt;p&gt;
With the latest template, css and js changes in 2.0, there are a number of things that need preparation prior to a production deployment.  One of these is:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;the fanstatic_resources defined in &lt;tt&gt;ckan/lib/fanstatic_resources.py&lt;/tt&gt; (bottom of module) should be prepared, and minified.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
This ticket is to:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;provide a paster command which when run will generate the minified javascript as css files.
&lt;/li&gt;&lt;li&gt;stop the auto-minification of files when CKAN starts up.
&lt;/li&gt;&lt;li&gt;remove reference to the minified files in the &lt;tt&gt;.gitignore&lt;/tt&gt; file.
&lt;/li&gt;&lt;li&gt;add instruction to the release process to run this command, and check-in the minified files to the repo.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
## Background
&lt;/p&gt;
&lt;p&gt;
Currently, minification works seamlessly without the need for any preparation when CKAN is started in a development setup.  But on a production site, the webserver will (almost certainly) not have write-access to the directories that will contain the minified files.  And so the minification will fail, and the site will end up serving the un-minified media, or even *old* minified media.
&lt;/p&gt;
&lt;p&gt;
One way around this would be to allow webserver write access to the directory its serving out of.  But this is not generally considered good practice.
&lt;/p&gt;
&lt;p&gt;
Another method would be to distribute the minified files with CKAN.  This ticket describes how to do this without causing a lot of noise in the commit history of the repo.
&lt;/p&gt;
&lt;p&gt;
The auto-minifcation occurs when importing &lt;tt&gt;ckan/lib/fanstatic_resources.py&lt;/tt&gt;.
&lt;/p&gt;
&lt;p&gt;
## Changing the process slightly
&lt;/p&gt;
&lt;p&gt;
The reason for moving away from auto-minifying files at start-up, to minifying files when running a paster command is:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;we should be distributing the minified files when we make a release (as we do with translation files).  This makes it easier to install CKAN from source.
&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;if we distribute the minified files, then they need to be checked-in to the repo.
&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;if they are auto-minified, whenever small changes are made, then this will create a lot of noise in the repo.  It will be clearer to have the minified-files generated manually as part of the release process. (Or whever we make a deployment internally).
&lt;/li&gt;&lt;/ul&gt;</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/2950</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>icmurray</dc:creator>

      <pubDate>Mon, 01 Oct 2012 19:12:38 GMT</pubDate>
      <title>summary changed</title>
      <link>http://localhost/ticket/2950#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/2950#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;summary&lt;/strong&gt;
                changed from &lt;em&gt;paster commands to prepare codebase for deployment&lt;/em&gt; to &lt;em&gt;paster command to minify javascript&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>toby</dc:creator>

      <pubDate>Tue, 02 Oct 2012 09:07:18 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/2950#comment:2</link>
      <guid isPermaLink="false">http://localhost/ticket/2950#comment:2</guid>
      <description>
        &lt;p&gt;
just a note to say fanstatic will serve minified files if it finds them in production even if they are old so we need to make sure they  are up to date.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>icmurray</dc:creator>

      <pubDate>Tue, 02 Oct 2012 10:42:44 GMT</pubDate>
      <title>description, summary changed</title>
      <link>http://localhost/ticket/2950#comment:3</link>
      <guid isPermaLink="false">http://localhost/ticket/2950#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/2950?action=diff&amp;amp;version=3"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;summary&lt;/strong&gt;
                changed from &lt;em&gt;paster command to minify javascript&lt;/em&gt; to &lt;em&gt;paster command to minify javascript and css&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>seanh</dc:creator>

      <pubDate>Tue, 02 Oct 2012 14:54:14 GMT</pubDate>
      <title>status changed; resolution set</title>
      <link>http://localhost/ticket/2950#comment:4</link>
      <guid isPermaLink="false">http://localhost/ticket/2950#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>