dev-rke / Codiad-LessCompiler

Less Compiler Plugin for Codiad IDE
2 stars 1 forks source link

Not processing @import statements correctly #1

Open jamieisboss opened 10 years ago

jamieisboss commented 10 years ago

Hi,

I've just installed this plugin and tried to use it on one of my projects that uses a series of less files that use @import statements (specifically, it's a wordpress install using the awesome bones theme http://themble.com/bones/)

When I save my less file, I get an error that the first import file is missing (_normalize.less), the exception suggests that the less compiler is looking for the imports in the root of the domain that Codiad is installed in rather than in the folder containing the less files.

Thanks for writing this awesome plugin! I've been using a shell script with the macro plugin to manually run lessc and this is so much better!

Jamie

dev-rke commented 10 years ago

Hi Jamie,

can you please post your directory structure? Can you also please post the path of the imported file that fails using Firebug / Chrome Developer Tools?

rke

jamieisboss commented 10 years ago

No problem,

directory structure:

/wp-content/themes/themename/library/less/style.less /wp-content/themes/themename/library/less/ie.less /wp-content/themes/themename/library/less/_mixins.less /wp-content/themes/themename/library/less/_base.less /wp-content/themes/themename/library/less/_768up.less etc.

/wp-content/themes/themename/library/css/style.css /wp-content/themes/themename/library/css/ie.css

Each of those .less files that are not prefixed with an underscore compile to a .css file in a folder called css with the same parent. The underscore prefixed files are all included in the non-prefixed ones.

This was the macro i was running to achieve a similar effect before:

lessc %FOLDER%/style.less %FOLDER%/../css/style.css

There is one error in the console for each of the underscore prefixed files:

GET http://ide.jamies-test-domain.co.uk/_normalize.less 404 (Not Found) VM195:13 q VM195:13 r VM195:13 I.imports.push VM195:13 a.importVisitor.visitImport VM195:15 a.visitor.visit VM195:15 a.visitor.visitArray VM195:15 a.Ruleset.accept VM195:15 a.visitor.visit VM195:15 a.importVisitor.run VM195:15 F.parse VM195:13 codiad.LessCompiler.LessCompiler.compileLessAndSave init.coffee:113 (anonymous function) init.coffee:1 (anonymous function) init.coffee:59 a.amplify.publish amplify.min.js:10 codiad.active.save init.js:452 manager.addCommand.exec init.js:53 (anonymous function) ace.js:1 r._emit.r._dispatchEvent ace.js:1 exec ace.js:1 $callKeyboardHandlers ace.js:1 onCommandKey ace.js:1 onCommandKey ace.js:1 o ace.js:1 (anonymous function) ace.js:1

Codiad runs on that subdomain http://ide.jamies-test-domain.co.uk/

Hope this helps

Thanks

Jamie

dev-rke commented 10 years ago

Hi Jamie,

please give it another try, it should work now. I tested it with different locations and path names. :-)

dev-rke commented 10 years ago

Hi Jamie,

have you tried the new version? It should also be available in the Codiad Marketplace.

jamieisboss commented 10 years ago

Hi, I'm unfortunately away for the Easter weekend now but will try as soon as I'm back working on Monday.

Thanks

Jamie

On 17 Apr 2014 21:08, dev-rke notifications@github.com wrote:

Hi Jamie,

have you tried the new version? It should also be available in the Codiad Marketplace.

— Reply to this email directly or view it on GitHubhttps://github.com/dev-rke/Codiad-LessCompiler/issues/1#issuecomment-40756909.


Important Notice: the information in this email and any attachments is for the sole use of the intended recipient(s). If you are not an intended recipient, or a person responsible for delivering it to an intended recipient, you should delete it from your system immediately without disclosing its contents elsewhere and advise the sender by returning the email or by telephoning a number contained in the body of the email. No responsibility is accepted for loss or damage arising from viruses or changes made to this message after it was sent. The views contained in this email are those of the author and not necessarily those of Liverpool John Moores University.

jamieisboss commented 10 years ago

Hi There,

Unfortunately this is still not working;

Reading my explanation back it maybe needs more description:

when any of the files in the directory are saved(underscore or not), all of the files without underscore prefixes should be compiled to less.

If this isn't the intended functionality then please excuse me, I read a while ago that this was the reason for the underscore prefixes but I can't find the article any more so maybe I'm mistaken.

Are there any more logs I could provide?

Thanks

Jamie

dev-rke commented 10 years ago

Hi Jamie,

saving the file style.less now does not trigger the less compiler.

This should work... any error messages? What happens, when you try again? Did you reload Codiad with an empty browser cache?

saving one of the underscore prefixed files triggers the compiler but gives an error that a variable is undefined. (no error to the console)

Which plugin causes the error? Is there any hint for a line or something?

All of the variables are saved in the file _mixins.less so the compiler is probably trying to compile the file I'm editing rather than the parent (style.less) file

This is not an intended feature. You want the compiler to compile another file than that you are editing. I implemented the compiler just for the case to compile the current file and to find any included files. If you want to compile the main file, you have to open and to save your style.less.

The only thing i could do is to implement a watcher functionality per project, so you can select the files that should be compiled when saving any less file. But unfortunately Codiad does not support project based plugin settings, so i have to write something on my own. A watcher should be more useful in a global context of the IDE, so Codiad itself should have this feature. I will work on this, but it might take a few weeks until you may see some results.