html partials

It would be awesome to have built-in partials/include support for html files.
Basically I need the ability to combine small html templates into larger ones. Ideally, when you open the template you'd see the the included partial; clicking on the block would open the partial for editing and all changes woudl reflect in real-time in the template.

I'm currently using grunt-bake for this but it's not ideal (Webstorm doesn't "see" the relationship between files).

3 comments
Comment actions Permalink

Please see https://youtrack.jetbrains.com/issue/WEB-341.
I'd suggest using existing template languages for building HTML pages from partials - Jade, for example

0
Comment actions Permalink

There are a lot of templating languages out there.  It would be unreasonable to expect to have JetBrains IDEs support most of them or the most popular ones.  Instead, it is reasonable to ask that JetBrains provide support for allowing developers to use template languages without numerous handicaps.  

For example, autocompleting of CSS classes requires that each file edited have a reference the IDE can understand to each CSS file which may contain those classes.  This is a large flaw in two ways:

1.  If one is building final web page output from any collection of partial web pages (in a DRY style, supported by many templating languages), only one of those partials is going to contain links to the CSS files needed.  Hence, autocomplete will fail on the rest of the partials, which likely comprise the majority of the HTML and where most work will be done.  There is no hack or work around for this situation that does not waste huge amounts of developer time, without custom-created HTML rewriting programs.

2.  Many deployment environments differ in their directory path names from the development environments.  Deployment often needs to pull in specific versions of files, in specific places.  It's unreasonable to expect that DOCUMENT_ROOT relative paths used in the deployed final web pages will match the location of the files in the development environment.  There are ugly symlink hacks to work around this.

Both problems could be solved by JetBrains by simply allowing the IDE to specify always-included resource files, much like CLion and AppCode already provide for language-specific header files.

0
Comment actions Permalink

>For example, autocompleting of CSS classes requires that each file edited have a reference the IDE can understand to each CSS file which may contain those classes

Normally completion is available for all selectors defined in project .css/.scss files unless the template file has a <link> or <style> tag: in the latter case, only selectors defined in explicitly linked .css files/embedded stylesheets are shown in completion on first Ctrl+space hitting; IDE suggests CSS classes from all project CSS files  if code completion is invoked twice

0

Please sign in to leave a comment.