Permalink
Browse files

Default to automatically previewing all HTML files

  • Loading branch information...
1 parent 0f8b70f commit 798567f3075ac076d46e5535ebdbc8861b6afd9f Gerd Knops committed May 25, 2012
Showing with 19 additions and 25 deletions.
  1. +8 −15 Commands/AutoPreview HTML.tmCommand
  2. +11 −10 README.md
@@ -5,26 +5,19 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>#!/bin/sh
+ <string>#!/bin/bash
if [ "X$HTML_APLO_PREVIEW_FILE" != 'X' ]; then
APLO_PREVIEW_HTML_FILE=$HTML_APLO_PREVIEW_FILE
else
- if [ "X$HTML_APLO_PREVIEW_AUTO" == 'X' ]; then
+ if [ "X$HTML_APLO_PREVIEW_NO_AUTO" != 'X' ]; then
exit
else
- for string in $TM_SCOPE
- do
- case "$string" in
- *text.html*)
- APLO_PREVIEW_HTML_FILE=$TM_FILEPATH
- ;;
- *)
- echo "Not a HTML file?"
- exit
- ;;
- esac
- done
+ if [[ "$TM_SCOPE" =~ ^text.html.basic ]]; then
+ APLO_PREVIEW_HTML_FILE=$TM_FILEPATH
+ else
+ exit 0
+ fi
fi
fi
@@ -37,8 +30,8 @@ export APLO_PREVIEW_HTML_FILE APLO_WINDOW_NAME APLO_DELETE_FILE
aploPath=/tmp/aplo-html-$$.aplo
env&gt;$aploPath
-echo $aploPath
open -g $aploPath
+echo "$APLO_WINDOW_NAME updated"
</string>
<key>input</key>
<string>none</string>
View
@@ -6,9 +6,9 @@ The `HTML-ApLo.tmbundle` TextMate2 bundle provides support for a semi-automatic
By default it is tied to the `callback.document.did-save` semantic class and the `text.html, source.css and source.js` scopes, so it can update the preview whenever one of these file types is saved.
-It requires [`ApLo.tmbundle`](https://github.com/gknops/aplo.tmbundle).
+It requires [*ApLo.tmbundle*](https://github.com/gknops/aplo.tmbundle).
-**NOTE**: either the `HTML\_APLO\_PREVIEW\_AUTO` or the `HTML\_APLO\_PREVIEW\_FILE` variable have to be set in a `.tm_properties` file for the preview to work.
+**NOTE**: if the `HTML_APLO_PREVIEW_FILE` variable has to be set in a `.tm_properties` file for the preview to work when JavaScript or CSS files are saved.
**NOTE**: this bundle does NOT replace the standard HTML bundle, you still need that for the language definition etc.
@@ -26,17 +26,18 @@ Open a terminal window and enter these commands:
To enable this plugin some variables need to be defined in a `.tm_properties` file, either in the project directory, one of it's subdirectories or anywhere else `.tm_properties` files are allowed at.
-HTML\_APLO\_PREVIEW\_FILE
-HTML\_APLO\_PREVIEW\_AUTO
-HTML\_APLO\_WINDOW\_TITLE
-
-## HTML\_APLO\_PREVIEW\_AUTO
-
-When defined and set to anything but an empty string, a preview of any HTML file in the directories governed by the `.tm_properties` file will be displayed. Note that in this configuration the bundle will not show/update the preview when CSS or JavaScript files are saved.
## HTML\_APLO\_PREVIEW\_FILE
-This variable should contain the fill path to a HTML file. When set, Saving any html, CSS or JavaScript file within the directories governed by the `.tm_properties` file will cause the Preview to be updated.
+This variable should contain the full path to a HTML file. When set, Saving any HTML, CSS or JavaScript file within the directories governed by the `.tm_properties` file will cause the Preview for the file defined in the variable to be updated.
+
+## HTML\_APLO\_PREVIEW\_NO\_AUTO
+
+By default the bundle will show a preview of any HTML file saved. To suppress this define the `HTML\_APLO\_PREVIEW\_NO\_AUTO` and set it to a non-empty string. For example adding
+
+ HTML_APLO_PREVIEW_NO_AUTO = "anything"
+
+to the `.tm_properties` file in your home directory will disable HTML preview for any HTML file unless `HTML\_APLO\_PREVIEW\_FILE` is defined.
## HTML\_APLO\_WINDOW\_TITLE

0 comments on commit 798567f

Please sign in to comment.