[tip] Run script on file save

Ask questions about how to create a script or swap scripts with other users.
Post Reply
User avatar
pjj
Posts: 2109
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

[tip] Run script on file save

Post by pjj »

In the latest version (8.6x) Rickard introduced really great feature: run script on file save. It may be used for a panoply of actions, among them for building target files from source files, e.g. building one CSS files from many SASS/SCSS files (this is what I do, anyway.) I hope the snippet below will save you five minutes needed to make it up:

Code: Select all

// find extension
dotPosition = ScriptUtils.WRightPos(".", Document.FileName);
extension = copy(Document.FileName, dotPosition + 1, Length(Document.FileName) - dotPosition);

if (extension == "scss") {
 // do what you need to do with .scss files here
}
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Post Reply