Skip to content

Commit 2b23bdd

Browse files
committed
Create gh-pages branch via GitHub
0 parents  commit 2b23bdd

File tree

7 files changed

+726
-0
lines changed

7 files changed

+726
-0
lines changed

images/arrow-down.png

423 Bytes
Loading

images/octocat-small.png

570 Bytes
Loading

index.html

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="chrome=1">
6+
<title>Sublime View In Browser Plugin by adampresley</title>
7+
8+
<link rel="stylesheet" href="stylesheets/styles.css">
9+
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
10+
<script src="javascripts/scale.fix.js"></script>
11+
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
12+
<!--[if lt IE 9]>
13+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
14+
<![endif]-->
15+
</head>
16+
<body>
17+
<div class="wrapper">
18+
<header>
19+
<h1 class="header">Sublime View In Browser Plugin</h1>
20+
<p class="header">Open the contents of your current view/tab in a web browser</p>
21+
22+
<ul>
23+
<li class="download"><a class="buttons" href="https://github.com/adampresley/sublime-view-in-browser/zipball/master">Download ZIP</a></li>
24+
<li class="download"><a class="buttons" href="https://github.com/adampresley/sublime-view-in-browser/tarball/master">Download TAR</a></li>
25+
<li><a class="buttons github" href="https://github.com/adampresley/sublime-view-in-browser">View On GitHub</a></li>
26+
</ul>
27+
28+
<p class="header">This project is maintained by <a class="header name" href="https://github.com/adampresley">adampresley</a></p>
29+
30+
31+
</header>
32+
<section>
33+
<h1>Sublime Text 2 - View In Browser</h1>
34+
35+
<p><em>View In Browser</em> is a Sublime Text 2 plugin that will open whatever is in your
36+
current view/tab. If the file current open is new and has not been saved a temporary
37+
file is created (in your default temp directory for your OS) with the extension of
38+
<strong>.htm</strong> and your browser will open it. However if the current open file is saved
39+
and has a name this plugin will open it in whatever you have set to handle
40+
its type.</p>
41+
42+
<p>By default the keystroke assigned to this plugin is <em>CTRL + ALT + V</em>.</p>
43+
44+
<h2>Installation</h2>
45+
46+
<p>Using the Sublime Text 2 Package Control plugin (<a href="http://wbond.net/sublime_packages/package_control">http://wbond.net/sublime_packages/package_control</a>)
47+
press <em>CTRL + SHIFT + P</em> and find <strong>Package Control: Install Package</strong> and press <em>Enter</em>.
48+
Find this plugin in the list by name <strong>View In Browser</strong>.</p>
49+
50+
<h2>Configuring Browsers</h2>
51+
52+
<p>By default this plugin will open files in Firefox. You can configure it to open
53+
using another browser of your choice. To do this, choose <em>Settings - User</em> from <em>Preferences &gt; Package Settings &gt; View In Browser</em>.</p>
54+
55+
<p>The browser you wish to use to open files is set in the key named <strong>selectedBrowser</strong>. The list of browsers
56+
you can use and configure are in the key named <strong>supportedBrowsers</strong>.</p>
57+
58+
<p>The <strong>supportedBrowsers</strong> values can be configured to have paths to your browser installations.
59+
Each browser listed is an array (list) of configurations that allow you to setup a browser
60+
for multiple operating systems. For example under <em>chrome</em> there are two configurations.
61+
The first is for your average Linux system. The second is for Windows. </p>
62+
63+
<h3>Windows Considerations</h3>
64+
65+
<p>One of the things you may notice in the Windows configuration for <em>chrome</em> is a variable in
66+
the command path that looks like: <strong>%Local AppData%</strong>. This is a reference to your Windows
67+
installation's <strong>AppData</strong> folder in your user profile directory. There is a variable
68+
there because this value will differ for each user on your computer, and Chrome installs
69+
to your <strong>AppData</strong> folder.</p>
70+
71+
<p>Here is a list of supported variables:</p>
72+
73+
<ul>
74+
<li>
75+
<strong>AppData</strong> - Your main application data folder for your profile (usually roaming)</li>
76+
<li>
77+
<strong>Personal</strong> - Your documents ___location</li>
78+
<li>
79+
<strong>Desktop</strong> - The path to your Desktop ___location (may be unreliable)</li>
80+
<li>
81+
<strong>Start Menu</strong> - The path to your Start Menu items ___location</li>
82+
<li>
83+
<strong>Local AppData</strong> - Your local application data folder for your profile</li>
84+
<li>
85+
<strong>My Video</strong> - Path to your videos ___location</li>
86+
<li>
87+
<strong>My Pictures</strong> - Path to your pictures ___location</li>
88+
<li>
89+
<strong>My Music</strong> - Path to your music ___location</li>
90+
</ul><p>Note that many of these are not terribly useful for determining browser ___location, unless you
91+
have decided to install Firefox in your My Music folder. </p>
92+
93+
<h2>Configure to View on Local Server</h2>
94+
95+
<p>The View In Browser plugin also supports the ability to view files in the context of
96+
a local server. So if you have a local Apache, Tomcat, or some other server application running
97+
you can configure this plugin to open your file prefixed with a URL. </p>
98+
99+
<p>To configure this the View In Browser plugin reads the configuration of your currently
100+
loaded project. You can edit a project file by opening the <em>sublime-project</em> file
101+
by choosing <strong>Project</strong> -&gt; <strong>Edit Project</strong>. In your project file you will need to specify
102+
two things:</p>
103+
104+
<ul>
105+
<li>
106+
<strong>baseUrl</strong> - The root URL to prefix files with </li>
107+
<li>
108+
<strong>basePath</strong> - The base path where your site/application lives</li>
109+
</ul><p>Here's how that looks.</p>
110+
111+
<div class="highlight"><pre><span class="p">{</span>
112+
<span class="s2">"folders"</span><span class="o">:</span>
113+
<span class="p">[</span>
114+
<span class="p">{</span>
115+
<span class="s2">"path"</span><span class="o">:</span> <span class="s2">"/home/&lt;username&gt;/code/python/my-cool-website"</span>
116+
<span class="p">}</span>
117+
<span class="p">],</span>
118+
<span class="s2">"settings"</span><span class="o">:</span> <span class="p">{</span>
119+
<span class="s2">"sublime-view-in-browser"</span><span class="o">:</span> <span class="p">{</span>
120+
<span class="s2">"baseUrl"</span><span class="o">:</span> <span class="s2">"http://localhost:8080"</span><span class="p">,</span>
121+
<span class="s2">"basePath"</span><span class="o">:</span> <span class="s2">"/home/&lt;username&gt;/code/python/my-cool-website"</span>
122+
<span class="p">}</span>
123+
<span class="p">}</span>
124+
<span class="p">}</span>
125+
</pre></div>
126+
127+
<p>Notice the key named <strong>settings</strong> which is a dictionary that contains another key named
128+
<strong>sublime-view-in-browser</strong>. This is where you will put your <strong>baseUrl</strong> and <strong>basePath</strong>
129+
settings.</p>
130+
131+
<p>Now when you activate View In Browser your file will open with the HTTP protocol instead
132+
of the FILE protocol.</p>
133+
134+
<h2>Change History</h2>
135+
136+
<ul>
137+
<li>03/08/2013:
138+
139+
<ul>
140+
<li>Avoid loading Windows special folder references when on a Mac</li>
141+
<li>Added Mac Chrome to the supported browsers list</li>
142+
</ul>
143+
</li>
144+
<li>02/18/2013:
145+
146+
<ul>
147+
<li>Added ability to use Windows special folder references to browser commands. Closes
148+
<a href="https://github.com/adampresley/sublime-view-in-browser/issues/10">#10</a>
149+
</li>
150+
</ul>
151+
</li>
152+
<li>01/30/2013:
153+
154+
<ul>
155+
<li>All settings for this plugin now live in the file <strong>View In Browser.sublime-settings</strong>.
156+
This allows for a user to override them in their <em>User</em> directory. The old
157+
<strong>settings.json</strong> file is no longer used. </li>
158+
</ul>
159+
</li>
160+
<li>01/28/2013:
161+
162+
<ul>
163+
<li>Merged in change from imaginationac to remove menu nesting</li>
164+
</ul>
165+
</li>
166+
<li>12/26/2012:
167+
168+
<ul>
169+
<li>Added Linux Chromium to the supported browsers list</li>
170+
</ul>
171+
</li>
172+
<li>11/01/2012:
173+
174+
<ul>
175+
<li>Altered command to open Safari on Mac</li>
176+
<li>When invoked the current view is auto-saved</li>
177+
</ul>
178+
</li>
179+
<li>10/25/2012:
180+
181+
<ul>
182+
<li>New settings.json file to map browser/commands to OSes</li>
183+
<li>Plugin will use the specified browser to open files, or default to OS default when browser is unsupported</li>
184+
<li>Addressed encoding issue when calling open_new_tab</li>
185+
<li>Added ability to specify and respect local server config per project</li>
186+
</ul>
187+
</li>
188+
<li>05/21/2012:
189+
190+
<ul>
191+
<li>Temp file only created if view is unsaved</li>
192+
</ul>
193+
</li>
194+
<li>05/18/2012:
195+
196+
<ul>
197+
<li>Initial code</li>
198+
</ul>
199+
</li>
200+
</ul><h2>License</h2>
201+
202+
<p>The MIT License (MIT)
203+
Copyright (c) 2012 Adam Presley</p>
204+
205+
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
206+
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
207+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
208+
209+
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
210+
211+
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
212+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
213+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
214+
IN THE SOFTWARE.</p>
215+
</section>
216+
<footer>
217+
<p><small>Hosted on <a href="https://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p>
218+
</footer>
219+
</div>
220+
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
221+
222+
</body>
223+
</html>

javascripts/scale.fix.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
fixScale = function(doc) {
2+
3+
var addEvent = 'addEventListener',
4+
type = 'gesturestart',
5+
qsa = 'querySelectorAll',
6+
scales = [1, 1],
7+
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
8+
9+
function fix() {
10+
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
11+
doc.removeEventListener(type, fix, true);
12+
}
13+
14+
if ((meta = meta[meta.length - 1]) && addEvent in doc) {
15+
fix();
16+
scales = [.25, 1.6];
17+
doc[addEvent](type, fix, true);
18+
}
19+
20+
};

params.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Sublime View In Browser Plugin","tagline":"Open the contents of your current view/tab in a web browser","body":"# Sublime Text 2 - View In Browser\r\n\r\n*View In Browser* is a Sublime Text 2 plugin that will open whatever is in your\r\ncurrent view/tab. If the file current open is new and has not been saved a temporary \r\nfile is created (in your default temp directory for your OS) with the extension of \r\n**.htm** and your browser will open it. However if the current open file is saved\r\nand has a name this plugin will open it in whatever you have set to handle\r\nits type.\r\n\r\nBy default the keystroke assigned to this plugin is *CTRL + ALT + V*.\r\n\r\n## Installation\r\nUsing the Sublime Text 2 Package Control plugin (http://wbond.net/sublime_packages/package_control)\r\npress *CTRL + SHIFT + P* and find **Package Control: Install Package** and press *Enter*.\r\nFind this plugin in the list by name **View In Browser**.\r\n\r\n## Configuring Browsers\r\nBy default this plugin will open files in Firefox. You can configure it to open\r\nusing another browser of your choice. To do this, choose *Settings - User* from *Preferences > Package Settings > View In Browser*.\r\n\r\nThe browser you wish to use to open files is set in the key named **selectedBrowser**. The list of browsers\r\nyou can use and configure are in the key named **supportedBrowsers**.\r\n\r\nThe **supportedBrowsers** values can be configured to have paths to your browser installations.\r\nEach browser listed is an array (list) of configurations that allow you to setup a browser\r\nfor multiple operating systems. For example under *chrome* there are two configurations.\r\nThe first is for your average Linux system. The second is for Windows. \r\n\r\n### Windows Considerations\r\nOne of the things you may notice in the Windows configuration for *chrome* is a variable in\r\nthe command path that looks like: **%Local AppData%**. This is a reference to your Windows\r\ninstallation's **AppData** folder in your user profile directory. There is a variable\r\nthere because this value will differ for each user on your computer, and Chrome installs\r\nto your **AppData** folder.\r\n\r\nHere is a list of supported variables:\r\n\r\n* **AppData** - Your main application data folder for your profile (usually roaming)\r\n* **Personal** - Your documents ___location\r\n* **Desktop** - The path to your Desktop ___location (may be unreliable)\r\n* **Start Menu** - The path to your Start Menu items ___location\r\n* **Local AppData** - Your local application data folder for your profile\r\n* **My Video** - Path to your videos ___location\r\n* **My Pictures** - Path to your pictures ___location\r\n* **My Music** - Path to your music ___location\r\n\r\nNote that many of these are not terribly useful for determining browser ___location, unless you\r\nhave decided to install Firefox in your My Music folder. \r\n\r\n\r\n## Configure to View on Local Server\r\nThe View In Browser plugin also supports the ability to view files in the context of\r\na local server. So if you have a local Apache, Tomcat, or some other server application running\r\nyou can configure this plugin to open your file prefixed with a URL. \r\n\r\nTo configure this the View In Browser plugin reads the configuration of your currently\r\nloaded project. You can edit a project file by opening the *sublime-project* file\r\nby choosing **Project** -> **Edit Project**. In your project file you will need to specify \r\ntwo things:\r\n\r\n* **baseUrl** - The root URL to prefix files with \r\n* **basePath** - The base path where your site/application lives\r\n\r\nHere's how that looks.\r\n\r\n```javascript\r\n{\r\n\t\"folders\":\r\n\t[\r\n\t\t{\r\n\t\t\t\"path\": \"/home/<username>/code/python/my-cool-website\"\r\n\t\t}\r\n\t],\r\n\t\"settings\": {\r\n\t\t\"sublime-view-in-browser\": {\r\n\t\t\t\"baseUrl\": \"http://localhost:8080\",\r\n\t\t\t\"basePath\": \"/home/<username>/code/python/my-cool-website\"\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nNotice the key named **settings** which is a dictionary that contains another key named\r\n**sublime-view-in-browser**. This is where you will put your **baseUrl** and **basePath**\r\nsettings.\r\n\r\nNow when you activate View In Browser your file will open with the HTTP protocol instead\r\nof the FILE protocol.\r\n\r\n## Change History\r\n\r\n* 03/08/2013:\r\n * Avoid loading Windows special folder references when on a Mac\r\n * Added Mac Chrome to the supported browsers list\r\n* 02/18/2013:\r\n * Added ability to use Windows special folder references to browser commands. Closes \r\n <a href=\"https://github.com/adampresley/sublime-view-in-browser/issues/10\">#10</a>\r\n* 01/30/2013:\r\n * All settings for this plugin now live in the file **View In Browser.sublime-settings**.\r\n This allows for a user to override them in their *User* directory. The old \r\n **settings.json** file is no longer used. \r\n* 01/28/2013:\r\n * Merged in change from imaginationac to remove menu nesting\r\n* 12/26/2012:\r\n * Added Linux Chromium to the supported browsers list\r\n* 11/01/2012:\r\n * Altered command to open Safari on Mac\r\n * When invoked the current view is auto-saved\r\n* 10/25/2012:\r\n * New settings.json file to map browser/commands to OSes\r\n * Plugin will use the specified browser to open files, or default to OS default when browser is unsupported\r\n * Addressed encoding issue when calling open_new_tab\r\n * Added ability to specify and respect local server config per project\r\n* 05/21/2012:\r\n * Temp file only created if view is unsaved\r\n* 05/18/2012:\r\n * Initial code\r\n\r\n\r\n## License\r\nThe MIT License (MIT)\r\nCopyright (c) 2012 Adam Presley\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), \r\nto deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, \r\nand/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS \r\nIN THE SOFTWARE.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}

0 commit comments

Comments
 (0)