Skip to content

Commit 3c5d7a4

Browse files
committed
minor #1345 [StimulusBundle] Added docs on TypeScript support (evertharmeling, weaverryan)
This PR was merged into the 2.x branch. Discussion ---------- [StimulusBundle] Added docs on TypeScript support | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Issues | #1335 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Follow-up on #1335, added more info on usage of TypeScript controllers support. Commits ------- 237164f Tweaking wording 60c0b8e [StimulusBundle] Added docs about Typescript controller usage 3724401 [StimulusBundle] Revert adding var/ to .gitignore
2 parents d8c0068 + 237164f commit 3c5d7a4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/StimulusBundle/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.php-cs-fixer.cache
22
.phpunit.result.cache
33
composer.lock
4-
var/
54
vendor/
65
tests/fixtures/var

src/StimulusBundle/doc/index.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ necessary files. If not, or you're curious, see :ref:`Manual Setup <manual-insta
4444
Usage
4545
-----
4646

47-
You can now create custom Stimulus controllers inside of the ``assets/controllers.``
47+
You can now create custom Stimulus controllers inside of the ``assets/controllers``
4848
directory. In fact, you should have an example controller there already: ``hello_controller.js``:
4949

5050
.. code-block:: javascript
@@ -84,6 +84,14 @@ will activate.
8484
There's a *lot* more to learn about Stimulus. See the `Stimulus Documentation`_
8585
for all the goodies.
8686

87+
TypeScript Controllers
88+
~~~~~~~~~~~~~~~~~~~~~~
89+
90+
If you want to use `TypeScript`_ to define your controllers, you can! Install and set up the
91+
`sensiolabs/typescript-bundle`_. Then be sure to add the ``assets/controllers`` path to the
92+
`sensiolabs_typescript.source_dir` configuration. Finally, create your controller in that
93+
directory and you're good to go.
94+
8795
.. _ux-packages:
8896

8997
The UX Packages
@@ -570,3 +578,5 @@ it will normalize it:
570578
.. _`Vue`: https://vuejs.org/
571579
.. _`stimulus-use`: https://stimulus-use.github.io/stimulus-use
572580
.. _`stimulus-components`: https://stimulus-components.netlify.app/
581+
.. _`TypeScript`: https://www.typescriptlang.org/
582+
.. _`sensiolabs/typescript-bundle`: https://github.com/sensiolabs/AssetMapperTypeScriptBundle

0 commit comments

Comments
 (0)