Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal 8 SASS Theme
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Composer
plugin
Drupal 8 SASS Theme
Commits
3c01312b
Commit
3c01312b
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
#7
Implement base theme support
parent
b4e79122
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Handler.php
+16
-12
16 additions, 12 deletions
src/Handler.php
templates/{{ project_name }}.info.yml
+1
-1
1 addition, 1 deletion
templates/{{ project_name }}.info.yml
with
17 additions
and
13 deletions
src/Handler.php
+
16
−
12
View file @
3c01312b
...
...
@@ -124,7 +124,10 @@ class Handler
->
getExtra
()
+
[
'theme-d8-sass'
=>
[]];
$this
->
options
=
array_replace_recursive
([
'project_name'
=>
'mytheme'
,
'copy_starterkit'
=>
true
,
'base_theme'
=>
[
'name'
=>
'bartik'
,
'import'
=>
[],
],
'bower_assets'
=>
[
'global'
=>
false
,
'fonts'
=>
[],
...
...
@@ -222,6 +225,7 @@ class Handler
if
(
empty
(
$string
))
{
return
''
;
}
$string
=
str_replace
(
'THEMENAME'
,
'{{ project_name }}'
,
$string
);
$this
->
twig_loader
->
setTemplate
(
'fixed'
,
$string
);
return
str_replace
(
'"'
,
'"'
,
$this
->
twig
->
render
(
'fixed'
,
$this
->
getOptions
()));
...
...
@@ -330,18 +334,18 @@ class Handler
$finder
=
new
Finder
();
$finder
->
ignoreDotFiles
(
FALSE
);
# TODO: Replace this with the base_theme settings from composer.json
# TODO: Those settings also need to go into default settings above
// Copy all files
$this
->
copyFiles
(
$fs
,
$finder
,
$pluginRoot
.
'/templates'
,
$destination
);
if
(
$this
->
getOption
(
'copy_starterkit'
))
{
// Copy Bootstrap base theme files
$bootstrapPackage
=
$this
->
getPackage
(
'drupal/bootstrap'
);
if
(
$bootstrapPackage
)
{
$bootstrapRoot
=
$this
->
getInstallationManager
()
->
getInstallPath
(
$bootstrapPackage
);
$this
->
copyFiles
(
$fs
,
$finder
,
$bootstrapRoot
.
'/starterkits/sass'
,
$destination
);
}
// Copy all files
$this
->
copyFiles
(
$fs
,
$finder
,
$pluginRoot
.
'/templates'
,
$destination
);
// Handle optional base theme
$baseTheme
=
$this
->
getOption
(
'base_theme'
);
if
(
isset
(
$baseTheme
[
'package'
]))
{
$baseThemePackage
=
$this
->
getPackage
(
$baseTheme
[
'package'
]);
if
(
$baseThemePackage
&&
isset
(
$baseTheme
[
'starterkit'
]))
{
$starterkitRoot
=
$this
->
getInstallationManager
()
->
getInstallPath
(
$baseThemePackage
)
.
DIRECTORY_SEPARATOR
.
$baseTheme
[
'starterkit'
];
$this
->
copyFiles
(
$fs
,
$finder
,
$starterkitRoot
,
$destination
);
}
}
// Remove bower stuff if that's available globally
if
(
$this
->
getOption
(
'bower_assets'
)[
'global'
])
{
...
...
This diff is collapsed.
Click to expand it.
templates/{{ project_name }}.info.yml
+
1
−
1
View file @
3c01312b
core
:
8.x
type
:
theme
base theme
:
bartik
base theme
:
{{
base_theme.name
}}
name
:
'
{{
project_name
}}'
description
:
'
Drupal
theme
{{
project_name
}}'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment