Comments (5)
OK, I think I understand now! Thanks!
FWIW, here it is in action. No build step!
symfony new simple-datatables-demo --webapp --version=next --php=8.2 && cd simple-datatables-demo
composer config minimum-stability dev
composer config extra.symfony.allow-contrib true
composer req symfony/asset-mapper:^6.4
composer req symfony/stimulus-bundle:2.x-dev
composer req survos/simple-datatables-bundle
bin/console make:controller Simple -i
cat > templates/simple.html.twig <<END
{% extends 'base.html.twig' %}
{% block body %}
<table class="table" {{ stimulus_controller('@survos/simple-datatables-bundle/table', {perPage: 5, sortable: true}) }}>
<thead>
<tr>
<th>abbr</th>
<th>name</th>
<th>number</th>
</thead>
<tbody>
{% for j in 1..12 %}
<tr>
<td>{{ j |date('2023-' ~ j ~ '-01') |date('M') }}</td>
<td>{{ j |date('2023-' ~ j ~ '-01') |date('F') }}</td>
<td>{{ j }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
END
symfony server:start -d
symfony open:local --path=/simple
from ux.
If you're putting the CSS in autoimport
, you shouldn't need to do anything else. It should output inside the ux_controller_link_tags()
function.
But, more generally, if you WERE to import a CSS file from JS, you'd need to use either the relative path to the file or, if your CSS file is in importmap.php
(it probably isn't), then you could use the import name there. But inside of JS, asset mapper paths are meaningless. These are really just for using with the asset()
Twig function.
from ux.
Perhaps I need not a namespaced path, but a relative path, like ../syle.css? If so, would that get expanded during the autoimport to vendor/...?
from ux.
Indeed, the css is not in the importmap.php, how is that added? I do have it in my bundle
We add a namspaced path via prepending configuration - good example here - https://github.com/symfony/ux/blob/2.x/src/Autocomplete/src/DependencyInjection/AutocompleteExtension.php#L52-L61
from ux.
So I did have that logic in my bundle, but it was pointing to the src/Controllers directory. I've fixed it now so that it points to assets and the controllers and css are available.
bin/console debug:asset-map | grep survos/simple
/home/tac/g/survos/surv...atatables-bundle/assets @survos/simple-datatables
@survos/simple-datatabl...atatables_controller.js /home/tac/g/survos/surv...atatables_controller.js
@survos/simple-datatabl...ers/table_controller.js /home/tac/g/survos/surv...ers/table_controller.js
@survos/simple-datatables/package.json /home/tac/g/survos/surv...dle/assets/package.json
@survos/simple-datatables/style.css /home/tac/g/survos/surv...bundle/assets/style.css
What is the format for importing the css from a bundle into the script?
<script type="module">
import '@survos/simple-datatables/style.css'
Isn't working, nor my variations on that, do I need some sort of import first?
from ux.
Related Issues (20)
- [TURBO] UX Turbo does not re-render form on error HOT 17
- [LiveComponent] make AsLiveComponent non-final HOT 2
- [LiveComponent] Redirection not working Symfony 7.0.1 live-component 2.13 HOT 5
- [Autocomplete + Live Component] Validation issue when using an autocomplete field in a live component HOT 2
- [LiveComponent] ElementChanges fails with 'DOMException: DOMTokenList.remove: The empty string is not a valid token' if HTML class attribute contains newlines HOT 6
- [Live Component + Autocomplete + Dynamics form] Change rendering problem HOT 5
- [TwigComponent] set anonymous template in a bundle directory HOT 5
- [Docs] Symfony UX not in general symfony search ? HOT 1
- [StimulusBundle] Deprecation after "symfony new --webapp" HOT 4
- [LiveComponent][Documentation] Unclear instructions for Javascript HOT 9
- [Autocomplete] Fetch results with elasticsearch HOT 3
- [UX Live] Wrong display value for loading element show HOT 5
- [Autocomplete] Module build failed @symfony/ux-autocomplete/package.json" could not be found HOT 3
- [LiveComponent] data-loading behaviour not working correctly in child components HOT 7
- [LiveComponent] addCollectionItem don't work when using DTO as source HOT 4
- [UX] 503 error with opcache JIT enabled HOT 5
- [TwigComponent] props reflexion HOT 7
- [TogglePassword] htmlspecialchars for button-classes HOT 4
- [TwigComponent][LiveComponent] Compatibility with Twig 2.9 / use_yield HOT 4
- Documentation could be improved by being clear about incompatibility with AssetMapper HOT 6
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 ux.