scout-app / scout-app

Scout-App - The simplest Sass processor
http://scout-app.io
MIT License
693 stars 101 forks source link

Allow custom @import paths #275

Open Blindmikey opened 7 years ago

Blindmikey commented 7 years ago

Unless I'm mistaken, right now @import only looks for files relative to the file importing it, or relative to the input directory.

Would be great to add custom import paths!

Great app btw super easy for the team to use. Thanks!

TheJaredWilcurt commented 7 years ago

@Blindmikey

Good news! You can already do this. There just isn't a simple way to do so in the UI currently.

C:\path\to\Scout-App\scout-files\mixins\mixins.config

You can add the paths to any folder you want Scout-App to look for your files in. It will look relative to where your Input folder is first, but if it can't find it there, it will look in each location mentioned in the mixins.config file. You can also add your global mixins directly into the the mixins folder itself. You'll notice that there are already a bunch of items in the file. They are separated by a return and are relative to the location of the Scout-App.exe file.

Let me know if that works for you. I wasn't sure if this feature would be useful to people, so I didn't put it in the UI. Part of what makes Scout-App good, is that it is simple and easy to use. Adding lots of extra settings and options works against that idea.

Let me know how you think this feature should best be handled. Should the location of the file just be documented somewhere? Should there be a modal in the app that lists and controls the contents of this file, giving users browse buttons to add more? Is this something enough people would use to justify putting it in the UI?

How is your team using this feature now. What makes this preferable to just pointing directly to where your files are, relative to the Input directory?

Thanks for the feedback.

Blindmikey commented 7 years ago

Hey @TheJaredWilcurt ! You are on it! Much appreciated!

This definitely helps to know. The only caveat I can think of is that I would need to request everyone on our dev team to add paths to that file.

It would be amazing if I could have a .scoutapp config file where I can add these paths, commit to repo, and have any future dev who pulls from the repo have their scout-app look in the same directories relative to input folder.

This would also aid in keeping the app UI clean, while allowing power users some advanced control via a config file. Just an idea.

How is your team using this feature now. What makes this preferable to just pointing directly to where your files are, relative to the Input directory?

It really just saves a small bit of headache figuring out relative paths. In a previous project using the ruby compiler, we were able to include OOCSS components with a simple @import 'e-button'; where as with scout ( which is preferred by most on my team because of its incredibly low learning curve ) we have to find the relative equivalent @import '../../elements/e-button';.

Again, not an issue at all, just purely a feature request :) I completely understand if such functionality might be too much.

Love your enthusiasm! Keep up the great work!

TheJaredWilcurt commented 7 years ago

I can see some utility in this idea. Scout-App produces a settings file per machine user in these locations:

But there is no per project file.

This feature, to have your own global imports, could be serviced easily in the UI. I've made a quick mockup. Note that due to browser security limitations, the accuracy of the folder browse button may be limited.

I put in an option to store the setting in the project folder or in the global settings. But upon further reflection I think a better option would be to have a Global Import Paths dialog, that looks like the above demo, and edits the mixins.config file. And then have additional settings accessible only when you have a project selected. So you can add in per-project level settings that are stored in the root of your project as .scout-app so they can be committed with the repo. I had originally consider just adding the settings into the package.json but there may be a person on a team that wants to use Scout-App, and not muddy up the repo for everyone else, so they wouldn't want the package.json modified, and the could add .scout-app to the .gitignore.

This is the best solution I could come up with. No idea when I'll have time to actually implement it though.