<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jefim Borissov &#187; Python</title>
	<atom:link href="http://jefim.eu/blog/category/it/programming/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://jefim.eu/blog</link>
	<description>Житие мое</description>
	<lastBuildDate>Fri, 05 Aug 2011 22:28:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Komodo Edit tools &#8211; add style.css and reset.css</title>
		<link>http://jefim.eu/blog/2009/10/komodo-edit-tool-style/</link>
		<comments>http://jefim.eu/blog/2009/10/komodo-edit-tool-style/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:28:49 +0000</pubDate>
		<dc:creator>Jefim</dc:creator>
				<category><![CDATA[Assorted]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web dev]]></category>
		<category><![CDATA[komodo]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[toolbox]]></category>

		<guid isPermaLink="false">http://jefim.eu/blog/?p=225</guid>
		<description><![CDATA[Good morning, planet. Today I am going to share a very useful script I am using in Komodo Edit (it automates adding style.css). It is very (!) simple yet very effective for me and, probably for others who are doing a lot of HTML files and face a problem of repetitive actions. This thing works [...]]]></description>
			<content:encoded><![CDATA[<p>Good morning, planet. Today I am going to share a very useful script I am using in Komodo Edit (it automates adding style.css). It is very (!) simple yet very effective for me and, probably for others who are doing a lot of HTML files and face a problem of repetitive actions.<br />
This thing works as follows (the use case):</p>
<ol>
<li> You create a new HTML file in komodo and save it in some directory.</li>
<li> You double-click the script in the Komodo Edit toolbox.</li>
<li> The script adds the following folders/files to the project (paths relative to the file currently in editor!)
<ul>
<li>css/</li>
<li>css/style.css</li>
<li>css/reset.css</li>
</ul>
</li>
<li>Also the file adds the following HTML code at the cursor in current opened file:</li>
</ol>
<pre name="code" class="html">
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</pre>
<p>Voila. The needed action is done.<br />
<span id="more-225"></span></p>
<h3>Now, the snippet code:</h3>
<pre name="code" class="python">
import sys
import shutil
import os
import os.path

# argv[1] - dir of cur project (%D)
# argv[2] - current file name (%F)
if os.path.exists(sys.argv[1]+'/css/') != True:
    os.mkdir(sys.argv[1]+'/css/')

# NB! Edit the paths to style.css and reset.css
# (these will be copied into your project)!
shutil.copy('C:/Work/__distributives/css/reset.css',sys.argv[1]+'/css/')
shutil.copy('C:/Work/__distributives/css/style.css',sys.argv[1]+'/css/')

print '
<link rel="stylesheet" type="text/css" href="css/reset.css" />'
print '
<link rel="stylesheet" type="text/css" href="css/style.css" />'
</pre>
<p>Save this as a file somewhere (e.g. C:/Work/__scripts/add_style_css.py).<br />
Open up Komodo Edit and add it to your toolbox (<em>Toolbox->Add->New command...</em>) with the following settings:</p>
<ul>
<li><strong>Command:</strong> python add_style_css.py %D %F</li>
<li><strong>Insert output:</strong> check</li>
<li><strong>Start in:</strong> whatever the script resides in (e.g. C:/Work/__scripts)</li>
<li>anything else should bet left as it is</li>
</ul>
<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://jefim.eu/blog/2009/10/komodo-edit-tool-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

