Comments (4)
hey @ahmadawais @asharirfan could you explain how to customize the configs to make image import work? I tried to integrate some loaders into the webpack.config.dev.js , but the compiler continues to fail when I start the "npm start" in "my-block". It seems I look at the wrong place, as none of the changes affects the compiling fail, (not even deleting the webpack.config.dev.js)
My goal is to place a static image file in a block, just like Jason.
So I placed an image within the block folder:
my-block/src/block/images/image.png
and try to import it to the block.js via
import image from './images/image.png'
and use it in the EDIT section
<img src={image} />
from create-guten-block.
Hey @jasonbahl 🙌
👉 Webpack config for create-guten-block
is handled by cgb-scripts
in here: https://github.com/ahmadawais/create-guten-block/tree/master/packages/cgb-scripts/config
You can customize the configs in this script to start supporting image imports.
✅ Image optimization is also in our goals for v2.0 #11
Cheers! 🥂
from create-guten-block.
@jasonbahl Image manipulation is a bit tricky since it has to do with WordPress generating the URL and webpack having the knowledge of that part. Maybe, the best way to move forward would be building a webpack-wp-image-loader.
Do you have the example for me where you're using the images and how? It will help me understand the usecase. Also would love your help with a PR for this one.
from create-guten-block.
@jasonbahl Can I get a final answer from you on this issue. Would you like to contribute this part? 🤔
from create-guten-block.
Related Issues (20)
- need css module support.
- Start works, but Build Fails HOT 3
- The externals list is outdated and doesn't support all the available Gutenberg components. HOT 2
- found 2 low severity vulnerabilities HOT 1
- Missing @wordpress/server-side-render dependency HOT 3
- Eject command HOT 1
- Cannot find module '/root/.npm/_npx/87162/lib/node_modules/create-guten-block/node_modules/@scarf/scarf/report.js' HOT 1
- common.scss file gets re-compiled/added multiple times with each successive block HOT 3
- How can you add multiple blocks to the same project? HOT 1
- Command failed: npm install cgb-scripts --save --save-exact --silent HOT 11
- Consider officially deprecating CGB HOT 7
- Do you have any examples of using render block
- Is it already possible to include a register_block_patterns() within this package?
- Having trouble getting started with multi-block HOT 1
- How to package our plugin
- Block.json is missing. Block styles will not load in future WordPress releases
- Module parse failed: Unexpected token while compiling block
- Only a package.json and a .gitignore file after running the npx command HOT 3
- blockNamePHPLower causes issue when its running as a function n ame
- create-guten-block is looking for active maintianers
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 create-guten-block.