Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Koala automatically compiles all files after adding a new folder #367

Closed
petetnt opened this issue Jan 29, 2015 · 11 comments
Closed

Koala automatically compiles all files after adding a new folder #367

petetnt opened this issue Jan 29, 2015 · 11 comments

Comments

@petetnt
Copy link

petetnt commented Jan 29, 2015

As of 2.0.4. (at least, I cannot remember this happening with 2.0.3.), Koala automatically compiles all files instantly after adding a folder. Consider following:

  1. Add a folder structure that has includes something like Bower installed Bootstrap, which includes tons of less files, out of which only bootstrap.less is supposed to be compiled.
  2. Koala automatically compiles ALL .less (and JS, Sass etc.) files which not only creates many useless files, it also makes Koala throw many errors due to missing variables and so on.

Simple test case would be:

  1. Create a folder called "test"
  2. In the folder, create a file called "test.less"
  3. Open the Folder in Koala
  4. -> "test.css" is automatically compiled

My suggestion would be either

  1. Add "automatically compile files when opening folders" option
  2. Allow toggle for "Auto Compile" in default settings per file type
    or
  3. Revert to previous behavior, in which the files are compiled only after modifying an included file so the user has time to remove unwanted autocompiling files.
@sprynm
Copy link

sprynm commented Feb 13, 2015

Seconded.

Even a folder setting would be helpful:

"options": {
// set if files should be automatically compiled when added to folder.
"autocompile": false
},

TIP: one way to minimize the clean up from this is to move all imports into a subfolder and configure Koala to ignore the mixins folder (assuming the latest version of Bootstrap). This way, when Koala triggers a full recompile again, mixins are skipped and the unwanted css files are all in one folder. Naturally, you have to adjust the @import statements for the new location: @import "components/variables.less";

IE:
/bootstrap.less
/koala-config.json
/components/variables.less .. etc
/mixins/alerts.less ... etc

@wondergiant
Copy link

Third'ed this. It would seem that default should be to not compile anything, and allow people to toggle all on later.

@oklai
Copy link
Owner

oklai commented Mar 26, 2015

Auto compiles all after adding a folder is for get the import files, then automatically watch them, just like sass --watch.
Another way to avoid unnecessary compilation is filter the component directory like bower_components, node_modules.

@petetnt
Copy link
Author

petetnt commented Mar 26, 2015

Thanks for the reply @oklai!

I haven't used plain sass --watch, but for example grunt watch only runs the tasks (for example compiling SCSS files or uglifying JS) after it notices the first change in the watched files. This way the first round of tasks is only run after user interaction, which gives the user some time to bail out in case of any problems.

@jvanasco
Copy link

This was really annoying. I just switched to Koala because an older compiler could not handle LESS imports correctly.

The only way to create a new project was to add the entire folder. Although I only want to build 5 files , there were over 100 LESS files (everything is modularized in our system and most were "library" items). Everything got added and everything auto-compiled.

Having the default to auto-compile is beyond annoying, especially when starting a project can only be done by importing an entire folder!

@Yelbaev
Copy link

Yelbaev commented Mar 21, 2016

This auto-compilation is very annoying.

I've spent several hours to understand how it works
First of all, on initiation of the app there is a line that defaults autocompile to true here
So it would be a great idea to modify that

But, there is a way to achieve custom behavior without touching core - just add an "autocompile": false to filetypes you don't want to autocompile into this file...

Just like it is done here

Hope this helps

@mikehatfield
Copy link

mikehatfield commented Aug 1, 2016

I was just testing out Koala for the first time. Instead of dragging and dropping a folder I clicked the + symbol assuming it would give me the opportunity to select a folder and then proceed. It did pop up a folder menu. I clicked through in the OSX file menu to find a project, then double clicked a root folder containing a lot of projects to navigate deeper. It auto selected that root folder and tried to add it as the project.

Since auto compile is on it started to process EVERY scss and less file. There is no warning in advance this behavior would occur. I do not think anything should be done without prompting the user. I was lucky it hit a few errors and was able to exit out of the application.

To make it worse, it overwrites the CSS files that may or may not have existed already.

Now I have 200+ CSS and related map files to sort through. What a PITA. I'm lucky it only hit 5 projects. It could have caused thousands of unwanted file changes.

I instantly uninstalled this app.

@AleRob90
Copy link

AleRob90 commented Sep 4, 2016

Please add more options. Added a project almost on production with +500 js, coffee, sass, css and less files and you probably know what happened. I read somwhere that you can rename your file with _ starting and it will be ignored....i cannot do that and i do not agree that should be the resolve. Just one button with "Auto-Compile" should do exactly the trick. You can enable what you want and you can disable them all at first. It's not gonna be used by a lot of people if it's gonna screw projects like this.
I'm still gonna use it because i have other projects that were starting from the begining with it and i was kinda satisfied, but this issue is not good at all

@chimmel
Copy link

chimmel commented Sep 16, 2016

How is this really still an issue this has been going on for way too long. I tried every one of what I thought might be viable implementations of Yelbaev's vague suggestion. Damn I am glad I came back to this tab because despite all that I had missed his core fix. It's hardly a hack. Just invert T/F instances in the value on that line. Finally.

@JoJoChilly
Copy link

Actually I tried to switch it off according to @Yelbaev . However when I dragged a file into Koala, it is still the same. I read the code for a while and I figured it out that in a file called projectManager.js, it would autoCompileWhenAdded LESS/Sass/CoffeeScript. And after i annotate call of that function, it finally worked. Hope to help someone want to close autocompile of LESS/Sass/CoffeeScript.
Here and here are the lines you should annotate.

@EEKimS
Copy link

EEKimS commented Oct 7, 2018

The fix you pushed for this doesn't seem to work anymore -- the box is unticked, but it is still autocompiling all of my sass files when i add a new project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests