Comments (25)
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.
ohhh, got it.
@bomberstudios was it the same request? Rerun the plugin of there is a change in the assets?
from skpm.
@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.
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.
As long as the assets are in plugin.sketchplugin/Contents/Resources
, there is no need to rebuild right?
from skpm.
Hi,
I'm using the Contents/Resources
to put here an external command so would be nice to watch the whole folder 😸
from skpm.
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.
The external command is called inside the cocoascript file within a NSTask, so it will know what to do with it 🤗
from skpm.
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.
agree, but you still have to run the plugin manually, while skpm build --watch --run
would do it for you...
from skpm.
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.
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.
then a "simple" watch Resources and run should be enough in this case, right?
from skpm.
Ah, you're right, I totally forgot that there's an actual .sketchplugin
folder in the project root 🤦♂️
from skpm.
(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.
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.
from skpm.
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.
from skpm.
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.
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.
from skpm.
It sure would be nice if these things were documented...
from skpm.
Right now they're being copied and compiled. That doesn't seem quite right.
from skpm.
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)
- skpm publish does not add or update lastUpdated flag in plugin directory HOT 5
- skpm-build --output: absolute paths are not supported
- Typescript bug: if I try use typescript file with .ts extension as a manifest script, build incorrectly replace the script name HOT 1
- Confused about skpm versions HOT 1
- Publishing on OSX Big Sur HOT 7
- Webpack 5
- skpm-build --watch doesn't update Sketch plugin folder HOT 2
- ssri vulnerability HOT 5
- Sass-loader not compatible with webpack version
- glob-parent vulnerability HOT 1
- Sketch crushes after trying to load a plugin HOT 1
- TextAlignment mistake on apple silicon HOT 1
- Cannot build project: TypeError: console.log.bind is not a function
- skpm breaking my plugin HOT 2
- null is not an object (evaluating 'NSApplication.sharedApplication().orderedDocuments().firstObject().showMessage') HOT 1
- How to notify in sketch after publishing?
- Builder is crashing because dependencies are old HOT 6
- [CVE-2023-0842] `xml2js` has vulnerability, needs updated
- Adding webbrowser api libraries to skpm puging
- one error with `babel-loader`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skpm.