-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for custom commands in frontend and setup targets. #195
Changes from 7 commits
033b75f
04db883
f1e17e3
7078706
bf9f0c7
0a47a25
069f8a9
16e4f39
097bf29
eab56ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,9 @@ | ||
<project name="frontend" default="frontend:install"> | ||
|
||
<target name="frontend:build" depends="frontend:install" description="Uses gulp to build front end dependencies for all themes."> | ||
<if> | ||
<isset property="project.themes"/> | ||
<then> | ||
<foreach list="${project.themes}" param="frontend.theme" target="frontend:build:run"/> | ||
</then> | ||
</if> | ||
<target name="frontend:build" description="Uses gulp to build front end dependencies for all themes."> | ||
<phingcall target="task:execute"> | ||
<property name="task-name" value="frontend-build"/> | ||
</phingcall> | ||
</target> | ||
|
||
<target name="frontend:build:run" depends="frontend:install" description="Uses gulp to build front end dependencies for a theme."> | ||
<if> | ||
<!-- We assume that if the theme name is not thunder, then a subtheme of thunder is being used. --> | ||
<not><equals arg1="${frontend.theme}" arg2="thunder" /></not> | ||
<then> | ||
<exec dir="${docroot}/themes/custom/${frontend.theme}" command="npm run build" logoutput="true" checkreturn="true" /> | ||
</then> | ||
</if> | ||
|
||
<property name="project.frontend.nvmrc.file" value="${docroot}/themes/custom/${frontend.theme}/.nvmrc" /> | ||
<if> | ||
<available file="${project.frontend.nvmrc.file}" /> | ||
<then> | ||
<copy file="${project.frontend.nvmrc.file}" todir="${repo.root}" /> | ||
</then> | ||
</if> | ||
</target> | ||
|
||
<target name="frontend:install" description="Installs front end dependencies for themes."> | ||
<!-- Enable support for multiple themes (Base + Subtheme or multisite deployments) --> | ||
<if> | ||
<isset property="project.themes" /> | ||
<then> | ||
<foreach list="${project.themes}" param="frontend.theme" target="frontend:install:run"/> | ||
</then> | ||
<else> | ||
<!-- Skip and tell user no themes were found --> | ||
<echo message="No Themes were found, skipping frontend:install."/> | ||
</else> | ||
</if> | ||
</target> | ||
|
||
<target name="frontend:install:run" description="Installs front end dependencies for a theme."> | ||
<if> | ||
<!-- We assume that if the theme name is not thunder, then a subtheme of thunder is being used. --> | ||
<not><equals arg1="${frontend.theme}" arg2="thunder" /></not> | ||
<then> | ||
<exec dir="${docroot}/themes/custom/${frontend.theme}" command="npm run install-tools" logoutput="true" checkreturn="true" /> | ||
</then> | ||
</if> | ||
</target> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,24 @@ drush: | |
# The default drush alias to be used when no environment is specified. | ||
default_alias: ${drush.aliases.local} | ||
|
||
# Custom tasks that are triggered at pre-defined times in the build process. | ||
# Available keys are frontend-build, post-deploy-build, and post-setup-build. | ||
tasks: | ||
# Executed when front end assets should be generated. | ||
frontend-build: | ||
# E.g., ${docroot}/sites/all/themes/custom/mytheme. | ||
dir: ${docroot} | ||
# E.g., `npm install` or `bower install`. | ||
command: echo 'Hello world!' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not crazy about "Hello world" here. I think it could be confusing to see it go past during a build, out of context. I'd rather see something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. |
||
# Executed after deployment artifact is created. | ||
post-deploy-build: | ||
dir: ${deploy.dir}/docroot/profiles/contrib/lightning | ||
command: npm install && bower install | ||
# Executed after setup:build:all is run. | ||
post-setup-build: | ||
dir: ${docroot}/profiles/contrib/lightning | ||
command: npm install && bower install | ||
|
||
# Hosting environment flags. | ||
# Examples: acsf (Acquia Cloud Site Factory), ac (Acquia Cloud) | ||
# hosting: "acsf" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description here feels a bit misleading to me. As a user I might expect there to already be some magic built in to find and compile my sass files with gulp. It's not clear by the description that I would need to define the command in my project.yml file. Unless I'm missing something which very well could be the case...