Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
2ffb24e7
Commit
2ffb24e7
authored
4 years ago
by
totten
Browse files
Options
Downloads
Patches
Plain Diff
Greenwich - Switch to composer-compile-lib
parent
4fed6a99
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Civi/Compile/Scss.php
+0
-49
0 additions, 49 deletions
Civi/Compile/Scss.php
ext/greenwich/composer.compile.json
+4
-5
4 additions, 5 deletions
ext/greenwich/composer.compile.json
with
4 additions
and
54 deletions
Civi/Compile/Scss.php
deleted
100644 → 0
+
0
−
49
View file @
4fed6a99
<?php
namespace
Civi\Compile
;
class
Scss
{
/**
* Compile some SCSS file(s).
*
* NOTE: This function runs during 'composer install', which is a pre-boot
* environment. The composer autoloader has been configured, but no other
* Civi services are online.
*
* @param array $task
* With keys:
* - scss-includes: string[], list of paths with SCSS helper files
* - scss-files: array, key-value mapping with input-files and output-files
*
* @see composer.json
* @link https://github.com/civicrm/composer-compile-plugin/blob/master/doc/tasks.md
*/
public
static
function
build
(
array
$task
)
{
$scssCompiler
=
new
\ScssPhp\ScssPhp\Compiler
();
$includes
=
$task
[
'scss-includes'
]
??
[];
foreach
(
$includes
as
$include
)
{
$scssCompiler
->
addImportPath
(
$include
);
}
if
(
empty
(
$task
[
'scss-files'
]))
{
throw
new
\InvalidArgumentException
(
"Invalid task: required argument 'scss-files' is missing"
);
}
foreach
(
$task
[
'scss-files'
]
as
$inputFile
=>
$outputFile
)
{
if
(
!
file_exists
(
$inputFile
))
{
throw
new
\InvalidArgumentException
(
"File does not exist: "
.
$inputFile
);
}
$inputScss
=
file_get_contents
(
$inputFile
);
$css
=
$scssCompiler
->
compile
(
$inputScss
);
$autoprefixer
=
new
\Padaliyajay\PHPAutoprefixer\Autoprefixer
(
$css
);
if
(
!
file_exists
(
dirname
(
$outputFile
)))
{
mkdir
(
dirname
(
$outputFile
),
0777
,
TRUE
);
}
$outputCss
=
$autoprefixer
->
compile
();
if
(
!
file_put_contents
(
$outputFile
,
$outputCss
))
{
throw
new
\RuntimeException
(
"Failed to write file:
$outputFile
"
);
}
}
}
}
This diff is collapsed.
Click to expand it.
ext/greenwich/composer.compile.json
+
4
−
5
View file @
2ffb24e7
...
...
@@ -3,13 +3,12 @@
{
"title"
:
"Greenwich CSS (<comment>dist/bootstrap3.css</comment>)"
,
"run"
:
[
"@php-eval mkdir('extern/select2', 0777, TRUE);"
,
"@php-eval $ok = copy('../../bower_components/select2/select2-bootstrap.css', 'extern/select2/select2-bootstrap.scss'); exit($ok?0:1);"
,
"@php-method
\\
Civi
\\
Compile
\\
Scss::build"
"@php-eval
\\
CCL::copy('../../bower_components/select2/select2-bootstrap.css', 'extern/select2/select2-bootstrap.scss');"
,
"@php-method
\\
CCL
\\
Tasks::scss"
],
"watch-files"
:
[
"scss"
,
"../../bower_components/select2/select2-bootstrap.css"
],
"scss-files"
:
{
"
scss/main.scss"
:
"dist/bootstrap3.
css"
},
"scss-i
nclude
s"
:
[
"scss"
,
"extern/bootstrap3/assets/stylesheets"
,
"extern/select2"
]
"scss-files"
:
{
"
dist/bootstrap3.css"
:
"scss/main.s
css"
},
"scss-i
mport
s"
:
[
"scss"
,
"extern/bootstrap3/assets/stylesheets"
,
"extern/select2"
]
}
]
}
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