Giter Club home page Giter Club logo

Comments (25)

bomberstudios avatar bomberstudios commented on May 24, 2024 1

I don't know… 😄

I guess I was hoping that skpm would rebuild the plugin whenever I edit anything on the project (think: images / html for panels / JSON / assets…)

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024 1

ohhh, got it.

@bomberstudios was it the same request? Rerun the plugin of there is a change in the assets?

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024 1

@rborn I guess so. Can you create another issue as this is not really related to this (watching the package.json and manifest.json)?

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

Right now it's only watching the files compiled with webpack, i.e. not the manifest.json or the package.json.

You are saying that it should watch them as well?

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

As long as the assets are in plugin.sketchplugin/Contents/Resources, there is no need to rebuild right?

from skpm.

rborn avatar rborn commented on May 24, 2024

Hi,

I'm using the Contents/Resources to put here an external command so would be nice to watch the whole folder 😸

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

But what would it do? I mean, even if it catches an change in the Contents/Resources folder, there is no way to know what it should do with it

from skpm.

rborn avatar rborn commented on May 24, 2024

The external command is called inside the cocoascript file within a NSTask, so it will know what to do with it 🤗

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

but there is "nothing" to do. Rebuilding the plugin just mean running webpack on the src. It doesn't do anything else. If you change the file in Contents/Resources, the plugin will automatically use it, no need to rebuild it

from skpm.

rborn avatar rborn commented on May 24, 2024

agree, but you still have to run the plugin manually, while skpm build --watch --run would do it for you...

from skpm.

bomberstudios avatar bomberstudios commented on May 24, 2024

Not sure. Here's my use case:

  • I create a new plugin
  • I start writing code, plugin builds as expected and is updated in Sketch
  • Now I want to tweak the description, or the name, or the version… so I edit the manifest.json or package.json, and the plugin is not built, and not updated in Sketch

Also, what if I update an asset in Resources (i.e: update an icon)? That should definitely trigger a rebuild and update the plugin in Sketch?

FTR, I don't want to run anything, just to be sure that whenever anything plugin-related is updated on my project, the plugin gets rebuilt.

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

while I understand for the manifest.json and the package.json (I also get tricked sometimes as well), there is no need to rebuild anything when updating an asset.

from skpm.

rborn avatar rborn commented on May 24, 2024

then a "simple" watch Resources and run should be enough in this case, right?

from skpm.

bomberstudios avatar bomberstudios commented on May 24, 2024

Ah, you're right, I totally forgot that there's an actual .sketchplugin folder in the project root 🤦‍♂️

from skpm.

bomberstudios avatar bomberstudios commented on May 24, 2024

(Apologies for the noise, I have another project where I use something similar to skpm but not exactly the same, and I was getting my memories all mixed up)

from skpm.

aparajita avatar aparajita commented on May 24, 2024

There's a good reason not to rely on keeping source resources in the plugin itself. If I'm editing an image, for example, in an image editor, I can't save it directly in plugin because the Save dialog sees it as a bundle and won't let me navigate to the Resources folder.

This is quite easy to fix using the copy-webpack-plugin, I'll make a PR that allows us to specify files/folders that will get copied into Plugin/Contents/Resources.

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

from skpm.

aparajita avatar aparajita commented on May 24, 2024

Copied into _webpack_resources with a hashed name? No thanks. To me this is one of the most crazy aspects of webpack. I shouldn't have to add a line of code in my Javascript for each static asset. The copy-webpack-plugin deals with static resources in a much better way, and also watches them for changes.

There are other scenarios where it just doesn't make sense to require an image in your code. For example, icons for Runner. And static resources that are part of a nib being loaded. In those cases it makes much more sense to just copy the static resources, because there is no processing going on.

It seems you don't want any changes made to skpm because you don't want any added maintenance. That's fine, I'll publish webpack plugins that won't require changes to skpm.

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

from skpm.

aparajita avatar aparajita commented on May 24, 2024

That's what I was going to do, add a "resources" field to "skpm" in package.json. I was going to allow it to be an array for flexibility. Anything in those folders (or matching those globs, even better), would be copied to the plugin's Resources folder.

from skpm.

aparajita avatar aparajita commented on May 24, 2024

And if a resources directory is specified, the hierarchy of that directory should be maintained during the copy. If you're going to use copy-webpack-plugin, you might as well allow the contents of the resources array to be either strings or objects. If objects, they are patterns that can be passed directly to the plugin.

from skpm.

mathieudutour avatar mathieudutour commented on May 24, 2024

from skpm.

aparajita avatar aparajita commented on May 24, 2024

It sure would be nice if these things were documented...

from skpm.

aparajita avatar aparajita commented on May 24, 2024

Right now they're being copied and compiled. That doesn't seem quite right.

from skpm.

ronyland avatar ronyland commented on May 24, 2024

I don't know… 😄

I guess I was hoping that skpm would rebuild the plugin whenever I edit anything on the project (think: images / html for panels / JSON / assets…)

I have the same need as you

from skpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.