I am putting together a sublime text 3 plugin that:
1: watches for php saved with lp_ prefix in certain folders 2: Creates an “assets” folder of same name with nearest lp/ folder 3: Creates /images folder and styles.css within folder
I am trying to extend this plugin so that if a lp_ file is saved that already has its corresponding assets folder then the folder is automatically uploaded via sftp.
I am using the sftp plugin by Wbond and was hoping I could get the two plugins to communicate but I am struggling, any help would be appreciated.
Plugin file:
‘’’
Plugin Name: Landing Page Folder Creator
Author: JH
Version: 1
Description: A plugin that automates the landing page folder creation
‘’’
import sublime, sublime_plugin, os
We extend event listener
class lp_folder_create(sublime_plugin.EventListener):
# This method is called every time a file is saved (not only the first time is saved)
def on_post_save_async(self, view):
variables = view.window().extract_variables()
fileBaseName = variables’file_base_name’] # File name without extension
file_path = variables’file_path’]
if fileBaseName.startswith('lp_'):
if file_path.endswith('/themes/freebingo'):
path = file_path + '/lp/' + fileBaseName
imagepath = path + '/images/'
os.mkdir(path)
os.mkdir(imagepath)
open(path + "/style.css", 'w')
if file_path.endswith('/themes/mobileslots'):
path = file_path + '/lp/' + fileBaseName
imagepath = path + '/images/'
print(file_path)
os.mkdir(path)
os.mkdir(imagepath)
open(path + "/style.css", 'w')
if file_path.endswith('/themes/tabletslots'):
path = file_path + '/lp/' + fileBaseName
imagepath = path + '/images/'
print(file_path)
os.mkdir(path)
os.mkdir(imagepath)
open(path + "/style.css", 'w')
if file_path.endswith('/themes/mobilebingo'):
path = file_path + '/lp/' + fileBaseName
imagepath = path + '/images/'
print(file_path)
os.mkdir(path)
os.mkdir(imagepath)
open(path + "/style.css", 'w')
if file_path.endswith('/themes/tabletbingo'):
path = file_path + '/lp/' + fileBaseName
imagepath = path + '/images/'
print(file_path)
os.mkdir(path)
os.mkdir(imagepath)
open(path + "/style.css", 'w')