Edit Menu Action for Bundles/Packages in Sublime Text 2

mopokouveb

New Member
I am switching from Textmate to Sublime and I am having trouble with getting a "Custom Menu Action" to work in Sublime. The Menu Action is a line of code that a co-worker wrote which compiles a LESS (css preprocessor) [filename].less and automatically minifies and updates 2 other files upon saving. The updated files are: 1. [filename].css and 2. [filename].css.vtl.We use a CMS that runs on Velocity, and we use it this way to throw the css onto the page to reduce http requests. This may sound dumb, but we have an enormous multi-tenant instance of over 800 sites, etc.Here is the code:\[code\]#!/bin/sh# This compiles the LESS and creates a CSS and CSS.VTL file# lessc is added to the usr/local/bin dir, add it to the pathPATH=$PATH:/usr/local/bin# get the filename without the extensionFILENAME=${TM_FILEPATH%.*}# get the filetype of the current file (will handle multiple . in the filepath)FILETYPE=${TM_FILEPATH##*.}# only compile if this is a less documentif [ "$FILETYPE" == "less" ]; then lessc "$TM_FILEPATH" "$FILENAME".css lessc "$TM_FILEPATH" "$FILENAME".css.vtl --compress echo "Successfully created the following files:" echo "$FILENAME.css" echo "$FILENAME.css.vtl"else echo "Not a less file: $TM_FILEPATH" echo "File type is $FILETYPE"fi\[/code\]I am new to backend code and I am not sure how to convert this to Python and update my LESS Package within Sublime.Thanks for any help, and apologies if I have missed some stackoverflow protocol.. this is my first post.-esorbma
 
Back
Top