less-preview icon indicating copy to clipboard operation
less-preview copied to clipboard

Import functionality

Open lukeapage opened this issue 12 years ago • 2 comments

How about a button that adds a new file and then exposes the ability for you to set filenames for each added file, so that you can import one thats still on the screen?

Not sure if its useful for people, but it would be useful for me!

lukeapage avatar Jan 11 '13 09:01 lukeapage

Can you clarify this? Specifically:

  • Do you want to be able to paste in test and then save that with a file name that can be imported into the editor?
  • Or are you looking to be able to upload files and them reference them via imports?

I think it would be useful to include something like this, and additionally to offer imports referencing popular LESS projects like boostrap. This is definitely going to have to be put on hold though for awhile, as it's not going to be trivial if we want it done correctly, and in a way that is useful.

bfricka avatar Jan 12 '13 04:01 bfricka

My initial impression is that he'd like to press a button that adds an additional code editor on the page, and assign it a virtual filename. Then, use an @import statement to include the virtual filename. Thus, you'd be able to test all sorts of @import functionality. However, purely client-side, this seems like it'd be hard to get the Less code to change the meaning of the @import statement.

So, let's assume that a server-component exists. You create a snippet, it gets assigned a key like "aaa1". Then you create another snippet, and use @import "aaa1.less";. You can easily open both files in separate windows, so no complicated UI work needs to be done.

And if Gists were supported (instead of a custom server component), then you could just @import "someGistKey.less" .... but I'm not familiar with the GitHub API so I don't know if the Gist would be served up correctly.

scottrippey avatar Jan 12 '13 06:01 scottrippey