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
ef402a1f
Commit
ef402a1f
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
#7
Change structure of bower asset definition
parent
3c01312b
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
+23
-34
23 additions, 34 deletions
src/Handler.php
templates/sass/_default-variables.scss
+1
-0
1 addition, 0 deletions
templates/sass/_default-variables.scss
with
24 additions
and
34 deletions
src/Handler.php
+
23
−
34
View file @
ef402a1f
...
...
@@ -128,42 +128,35 @@ class Handler
'name'
=>
'bartik'
,
'import'
=>
[],
],
'bower_assets'
=>
[
'global'
=>
false
,
'fonts'
=>
[],
'sass'
=>
[],
],
'bower_assets'
=>
[],
],
$extra
[
'theme-d8-sass'
]);
$fs
=
new
Filesystem
();
$dependencies
=
[];
$to
=
$this
->
buildInstallationPath
(
$this
->
options
[
'project_name'
]);
foreach
(
$this
->
options
[
'bower_assets'
]
[
'fonts'
]
as
$key
=>
$
def
)
{
foreach
(
$this
->
options
[
'bower_assets'
]
as
$key
=>
$
assets
)
{
$package
=
$this
->
getPackage
(
'bower-asset/'
.
$key
);
$from
=
$package
?
$this
->
getInstallationManager
()
->
getInstallPath
(
$package
)
:
NULL
;
if
(
!
$package
||
!
$fs
->
exists
(
$from
))
{
unset
(
$this
->
options
[
'bower_assets'
][
'fonts'
][
$key
]);
$version
=
$package
?
$package
->
getVersion
()
:
(
isset
(
$asset
[
'version'
])
?
$asset
[
'version'
]
:
'latest'
);
if
(
$package
)
{
// Installed globally as Composer package
$from
=
$this
->
getInstallationManager
()
->
getInstallPath
(
$package
);
if
(
!
$fs
->
exists
(
$from
))
{
// Global package is missing
unset
(
$this
->
options
[
'bower_assets'
][
$key
]);
continue
;
}
}
else
{
$converter
=
new
Converter
(
$from
,
$to
);
$this
->
options
[
'bower_assets'
][
'fonts'
][
$key
][
'src'
]
=
$converter
->
convert
(
$def
[
'src'
]);
}
}
$dependencies
=
[];
foreach
(
$this
->
options
[
'bower_assets'
][
'sass'
]
as
$key
=>
$def
)
{
$package
=
$this
->
getPackage
(
'bower-asset/'
.
$key
);
$from
=
$package
?
$this
->
getInstallationManager
()
->
getInstallPath
(
$package
)
:
NULL
;
if
(
!
$package
||
!
$fs
->
exists
(
$from
))
{
unset
(
$this
->
options
[
'bower_assets'
][
'sass'
][
$key
]);
// Will be installed locally via Bower
$from
=
implode
(
DIRECTORY_SEPARATOR
,
[
$to
,
'bower_components'
,
$key
]);
$dependencies
[]
=
'"'
.
$key
.
'": "'
.
$version
.
'"'
;
}
else
{
if
(
!
isset
(
$def
[
'version'
]))
{
$def
[
'version'
]
=
'latest'
;
$converter
=
new
Converter
(
$from
,
$to
);
foreach
([
'fonts'
,
'sass'
,
'js'
]
as
$type
)
{
if
(
isset
(
$asset
[
$type
]))
{
$this
->
options
[
'bower_assets'
][
$key
][
$type
][
'relative'
]
=
$converter
->
convert
(
$asset
[
'src'
]);
}
$converter
=
new
Converter
(
$from
,
$to
);
$this
->
options
[
'bower_assets'
][
'sass'
][
$key
][
'src'
]
=
$converter
->
convert
(
$def
[
'src'
]);
$dependencies
[]
=
'"'
.
$key
.
'": "'
.
$def
[
'version'
]
.
'"'
;
}
}
$this
->
options
[
'bower_assets'
][
'dependencies'
]
=
implode
(
",
\n
"
,
$dependencies
);
...
...
@@ -201,15 +194,11 @@ class Handler
protected
function
getIgnoredFiles
()
{
return
(
$this
->
getOption
(
'bower_assets'
)[
'global'
]
?
[
'bower.json'
]
:
[]
)
+
[
'config/install/{{ project_name }}.settings.yml'
,
'config/schema/{{ project_name }}.schema.yml'
,
return
array_merge
((
empty
(
$this
->
getOption
(
'bower_assets'
)[
'dependencies'
])
?
[
'bower.json'
]
:
[]),
[
'templates/README.md'
,
'README.md'
,
'{{ project_name }}.libraries.yml'
,
'{{ project_name }}.starterkit.yml'
,
'{{ project_name }}.theme'
,
];
]);
}
protected
function
getBinaryFiles
()
...
...
@@ -348,7 +337,7 @@ class Handler
}
// Remove bower stuff if that's available globally
if
(
$this
->
getOption
(
'bower_assets'
)[
'
global
'
])
{
if
(
empty
(
$this
->
getOption
(
'bower_assets'
)[
'
dependencies
'
])
)
{
if
(
$fs
->
exists
(
$destination
.
DIRECTORY_SEPARATOR
.
'bower.json'
))
{
$fs
->
remove
(
$destination
.
DIRECTORY_SEPARATOR
.
'bower.json'
);
}
...
...
@@ -371,7 +360,7 @@ class Handler
}
// Handle Bower if not installed globally
if
(
!
$this
->
getOption
(
'bower_assets'
)[
'
global
'
]
&&
$fs
->
exists
(
$destination
.
DIRECTORY_SEPARATOR
.
'bower.json'
))
{
if
(
!
empty
(
$this
->
getOption
(
'bower_assets'
)[
'
dependencies
'
]
)
&&
$fs
->
exists
(
$destination
.
DIRECTORY_SEPARATOR
.
'bower.json'
))
{
if
(
$update
)
{
$this
->
bower
(
'update'
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
templates/sass/_default-variables.scss
+
1
−
0
View file @
ef402a1f
// TODO: Make this configurable
// Set the directory for the Bootstrap Glyphicon font.
$icon-font-path
:
'../fonts/bootstrap/'
;
...
...
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