GithubHelp home page GithubHelp logo

Simplify front end file inclusion about blt HOT 5 CLOSED

acquia avatar acquia commented on July 25, 2024
Simplify front end file inclusion

from blt.

Comments (5)

grasmash avatar grasmash commented on July 25, 2024

@sarahjean Could you be more specific? The current patternset for files.frontend is:

  <patternset id="files.frontend">
    <include name="**/*.js"/>
    <!-- Ignore CSS. SASS usage is expected. CSS should be compiled. -->
    <exclude name="**/*.css"/>
    <exclude name="**/bower_components/**/*"/>
    <exclude name="**/css/**"/>
    <exclude name="**/dist/**/*"/>
    <exclude name="**/lib/**/*"/>
    <exclude name="**/node_modules/**/*"/>
    <exclude name="**/styleguide/**"/>
    <exclude name="**/vendor/**/*"/>
    <exclude name="**/gulpfile.js"/>
  </patternset>

This is including JS and is excluding a number of common third party directories. What is your goal? What should be excluded or included and why?

from blt.

sarahjean avatar sarahjean commented on July 25, 2024

@grasmash Yes, currently it grabs any and all JS, I am suggesting that it specifically look at JS provided by the theme, in a /js or /scripts folder, that way this doesn't need to be modified to exclude JS that might be in locations other than that which might not need to conform to Drupal Coder conventions (third party libraries, additional gulp or grunt files, code in node_modules, etc...)
A specific case that came up is in addition to <exclude name="**/gulpfile.js"/>, there was a sub directory with gulp tasks being imported which needed to be added on. Since Drupal themes typical include a /js, /scripts, or similar folder if we specifically target that we won't need to do as many one-off excludes.

from blt.

sarahjean avatar sarahjean commented on July 25, 2024

@grasmash A slightly better version:

  <patternset id="files.frontend">
    <include name="**/js/**/*.js"/>
    <include name="**/js/**/*.min.js"/>
    <exclude name="**/node_modules/**/*"/>
    <exclude name="**/vendor/**/*"/>
  </patternset>

Not excluding node_modules caused some local performance issues when trying to run validate:phpcs

from blt.

grasmash avatar grasmash commented on July 25, 2024

It seems odd that we should need to exclude node_modules. Was your node_modules dir nested under a js dir?

from blt.

sarahjean avatar sarahjean commented on July 25, 2024

@grasmash No, actually. I'm not sure what was happening there.

I think bigger picture it'd be good if this list could be updated via project.yml.

from blt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.