Skip to content

Commit

Permalink
Implemented usage of prefixr.com
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Engel committed Jan 1, 2012
1 parent c0070ae commit 756d428
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 22 deletions.
29 changes: 28 additions & 1 deletion CHANGELOG.txt
@@ -1 +1,28 @@
Place your change log text here. This file will be incorporated with your app at package time.
v 1.3

- implemented CSS minification (thanks to: https://github.com/GoalSmashers/clean-css )
If you don't want a css file to be minified, place the following comment in your less file: //simpless:!minify
- added a button for manual recompilation of files
- added a button for removing files from the list
- fixed a bug where compiling an empty less file crashes the program
- fixed a bug in the quit-restore system
- removed the restore button. Restoring now happens by default.
- fixed a bug where urls in stylesheets got messed up with random "app://com.wearekiss.simpless.open/" insertions.
- included LESS parser 1.1.6
- addded support for backwards @import. Compilation is triggered, if imported files are changed.
- capturing compiling errors in imported files now.
- fixed weird file path problems in appcelerator titanium


v 1.2

- implemented a new drag&drop system. Should work much more reliable now.
- fixed a bug where a space in the filepath prevented simpless from recognizing it.
- fixed a bug where the "show love" message was displayed when it shouldnt
- improved compilation error checking
- improved contrast in the colors of error messages in the UI
- included LESS parser 1.1.4
- added @import functionality
- when minimizing the app, it goes to the tray
- added a "restore last session" button
- implemented an automatic update checker
61 changes: 42 additions & 19 deletions Resources/js/app.js
Expand Up @@ -3,7 +3,7 @@
* Fork us on GitHub!
* Feel free to make any improvements to this little app and send us a notice! =)
* @author Christian Engel <christian.engel@wearekiss.com>
* @version 1.1
* @version 1.3
*/
var app = {
/**
Expand Down Expand Up @@ -237,7 +237,7 @@ var app = {
for (var i in restore_paths) {
app.drop_action(restore_paths[i]);
}
setTimeout(function(){
setTimeout(function() {
app.list_update();
}, 500);
}
Expand Down Expand Up @@ -413,10 +413,10 @@ var app = {
}
},

find_constraints: function(file_object){
app.debug('Finding constraints for: '+file_object);
if(!file_object.size()){
find_constraints: function(file_object) {
app.debug('Finding constraints for: ' + file_object);

if (!file_object.size()) {
app.debug('File is empty - stopping search for constraints');
return [];
}
Expand All @@ -439,7 +439,7 @@ var app = {
constraints = constraints.concat(app.find_constraints(path_obj));
} else {
constraints.push({
last_stamp: 0,
last_stamp: 0,
title: result[1],
obj: path_obj
});
Expand Down Expand Up @@ -469,7 +469,7 @@ var app = {

//So if there are already any lessfiles indexed, look if we can find our checksum.
//If we found it, we can leave here since we already have indexed this file.
if (app.lessfiles.length){
if (app.lessfiles.length) {
for (var i in app.lessfiles) {
if (app.lessfiles[i].inchecksum == checksum) return;
}
Expand Down Expand Up @@ -498,9 +498,9 @@ var app = {

var compiler_error = '';

for(var i in constraints){
if(!constraints[i].obj.exists()){
compiler_error = 'Import "'+constraints[i].title+'" not found';
for (var i in constraints) {
if (!constraints[i].obj.exists()) {
compiler_error = 'Import "' + constraints[i].title + '" not found';
break;
}
}
Expand Down Expand Up @@ -587,20 +587,20 @@ var app = {
// ../css/[NAME].css;
test = parent.grep('..' + s + 'css' + s);
if (test.exists() && test.isDirectory()) {
return '..'+s+'css' + s + filename + '.css';
return '..' + s + 'css' + s + filename + '.css';
}


//Attempt 2:
// ./css/[NAME].css;
test = parent.grep('.'+s+'css' + s);
test = parent.grep('.' + s + 'css' + s);
if (test.exists() && test.isDirectory()) {
return '.'+s+'css' + s + filename + '.css';
return '.' + s + 'css' + s + filename + '.css';
}

//Attempt 3:
// ./[NAME].css;
return '.'+s+filename + '.css';
return '.' + s + filename + '.css';
},

/**
Expand All @@ -615,9 +615,9 @@ var app = {

app.debug('Checking constraint files...');
var constraints = indexed_less_file_object.constraints;
for(var i in constraints){
if(!constraints[i].obj.exists()){
indexed_less_file_object.compiler_error = 'Import "'+constraints[i].title+'" not found';
for (var i in constraints) {
if (!constraints[i].obj.exists()) {
indexed_less_file_object.compiler_error = 'Import "' + constraints[i].title + '" not found';
indexed_less_file_object.compile_status = 2;
app.tray_status(2, err.message); //Red tray icon
return false;
Expand All @@ -635,6 +635,9 @@ var app = {
var minify = true;
if (lesscode.search(/simpless\:\!minify/) != -1) minify = false;

var prefixize = false;
if (lesscode.search(/simpless:autoprefix/) != -1) prefixize = true;

var parse_result = false;

//We have to remember this in case of @include statements.
Expand Down Expand Up @@ -664,6 +667,26 @@ var app = {
app.debug('Minifying CSS...');
csscode = CleanCSS.process(csscode);
}
if (prefixize) {
app.debug('Prefixizing CSS via prefixr.com ...');
var data = {
css: csscode,
simpless: Titanium.App.getVersion()
};
if(minify){
data.compress_option = 'on';
}
$.ajax({
async: false,
cache: false,
data: data,
type: 'POST',
url: 'http://prefixr.com/api/index.php',
success: function(response){
csscode = response;
}
});
}
var pointer = output.open();
pointer.open(pointer.MODE_WRITE);
try {
Expand Down Expand Up @@ -814,7 +837,7 @@ var app = {
uhr_str = '';
}

if (lessfile.compile_status == 2){
if (lessfile.compile_status == 2) {
uhr_str = lessfile.compiler_error;
addition = 'error';
}
Expand Down
2 changes: 1 addition & 1 deletion tiapp.xml
Expand Up @@ -22,7 +22,7 @@
<min-height>280</min-height>
<fullscreen>false</fullscreen>
<resizable>true</resizable>
<chrome scrollbars="true">true</chrome>
<chrome>true</chrome>
<maximizable>true</maximizable>
<minimizable>true</minimizable>
<closeable>true</closeable>
Expand Down
2 changes: 1 addition & 1 deletion timanifest
@@ -1 +1 @@
{"appname": "SimpLESS", "appid": "com.wearekiss.simpless.open", "appversion": "1.3", "mid": "v2:1e0de228-20de-4aee-abe1-1a67b4e8069e|c0d15058be903a1aa25eb58fdabbabc3", "publisher": "KISS", "url": "http://wearekiss.com", "desc": "A simple LESS compiler for Windows, osX and Linux", "release": false, "image": "icon.png", "platforms": ["osx", "win32"], "visibility": "private", "runtime": {"version": "1.1.0", "package": "include"}, "guid": "cd74c124-3f01-4726-9430-4cbc61e0340f", "modules": [{"name": "tiapp", "version": "1.1.0", "package": "include"}, {"name": "tifilesystem", "version": "1.1.0", "package": "include"}, {"name": "tiplatform", "version": "1.1.0", "package": "include"}, {"name": "tiui", "version": "1.1.0", "package": "include"}, {"name": "ticodec", "version": "1.1.0", "package": "include"}, {"name": "tidatabase", "version": "1.1.0", "package": "include"}, {"name": "timedia", "version": "1.1.0", "package": "include"}, {"name": "timonkey", "version": "1.1.0", "package": "include"}, {"name": "tinetwork", "version": "1.1.0", "package": "include"}, {"name": "tiprocess", "version": "1.1.0", "package": "include"}, {"name": "tiworker", "version": "1.1.0", "package": "include"}]}
{"appname": "SimpLESS", "appid": "com.wearekiss.simpless.open", "appversion": "1.3", "mid": "v2:1e0de228-20de-4aee-abe1-1a67b4e8069e|c0d15058be903a1aa25eb58fdabbabc3", "publisher": "KISS", "url": "http://wearekiss.com", "desc": "A simple LESS compiler for Windows, osX and Linux", "release": false, "image": "icon.png", "platforms": ["osx", "win32", "linux"], "visibility": "private", "runtime": {"version": "1.1.0", "package": "include"}, "guid": "cd74c124-3f01-4726-9430-4cbc61e0340f", "modules": [{"name": "tiapp", "version": "1.1.0", "package": "include"}, {"name": "tifilesystem", "version": "1.1.0", "package": "include"}, {"name": "tiplatform", "version": "1.1.0", "package": "include"}, {"name": "tiui", "version": "1.1.0", "package": "include"}, {"name": "ticodec", "version": "1.1.0", "package": "include"}, {"name": "tidatabase", "version": "1.1.0", "package": "include"}, {"name": "timedia", "version": "1.1.0", "package": "include"}, {"name": "timonkey", "version": "1.1.0", "package": "include"}, {"name": "tinetwork", "version": "1.1.0", "package": "include"}, {"name": "tiprocess", "version": "1.1.0", "package": "include"}, {"name": "tiworker", "version": "1.1.0", "package": "include"}]}

0 comments on commit 756d428

Please sign in to comment.