Create new build file that generates only bootstrap + font awesome

This is needed for some ckeditor calls
Add api_* function in order to call that file.
pull/2635/head^2
Julio Montoya 6 years ago
parent c2ca824e89
commit 6ee1412b98
  1. 2
      assets/css/bootstrap.scss
  2. 2
      assets/js/bootstrap.js
  3. 2
      main/admin/settings.lib.php
  4. 10
      main/inc/lib/api.lib.php
  5. 4
      main/inc/lib/javascript/ckeditor/config_js.php
  6. 2
      main/inc/lib/pdf.lib.php
  7. 2
      main/inc/lib/template.lib.php
  8. 4
      src/CoreBundle/Component/Editor/CkEditor/CkEditor.php
  9. 15
      webpack.config.js

@ -0,0 +1,2 @@
@import "~bootstrap/scss/bootstrap";
@import "~@fortawesome/fontawesome-free/css/all.css";

@ -0,0 +1,2 @@
import 'bootstrap';
import '@fortawesome/fontawesome-free';

@ -1214,7 +1214,7 @@ function addEditTemplate()
}
// Store the information in the database (as insert or as update).
$bootstrap = api_get_css(api_get_path(WEB_PUBLIC_PATH).'assets/bootstrap/dist/css/bootstrap.min.css');
$bootstrap = api_get_bootstrap_and_font_awesome();
$viewport = '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
if ($_GET['action'] == 'add') {

@ -7231,6 +7231,16 @@ function api_get_css($file, $media = 'screen')
return '<link href="'.$file.'" rel="stylesheet" media="'.$media.'" type="text/css" />'."\n";
}
function api_get_bootstrap_and_font_awesome($returnOnlyPath = false)
{
$url = api_get_path(WEB_PUBLIC_PATH).'build/css/bootstrap.css';
if ($returnOnlyPath) {
return $url;
}
return '<link href="'.$url.'" rel="stylesheet" type="text/css" />'."\n";
}
/**
* Returns the js header to include the jquery library.
*/

@ -13,11 +13,11 @@ if (api_get_setting('more_buttons_maximized_mode') === 'true') {
$template = new Template();
$template->assign(
'bootstrap_css',
api_get_path(WEB_PUBLIC_PATH).'assets/bootstrap/dist/css/bootstrap.min.css'
api_get_bootstrap_and_font_awesome(true)
);
$template->assign(
'font_awesome_css',
api_get_path(WEB_PUBLIC_PATH).'assets/fontawesome/css/font-awesome.min.css'
''
);
$template->assign(
'css_editor',

@ -460,7 +460,7 @@ class PDF
if ($addDefaultCss) {
$basicStyles = [
api_get_path(SYS_PATH).'web/assets/bootstrap/dist/css/bootstrap.min.css',
api_get_bootstrap_and_font_awesome(true),
api_get_path(SYS_PATH).'web/css/base.css',
api_get_path(SYS_PATH).'web/css/themes/'.api_get_visual_theme().'/default.css',
];

@ -677,7 +677,7 @@ class Template
/**
* Set theme, include mainstream CSS files.
*
* @deprecated
* @see setCssCustomFiles() for additional CSS sheets
*/
public function setCssFiles()

@ -56,8 +56,8 @@ class CkEditor extends Editor
{
$style = '';
if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '') {
$style = api_get_css_asset('bootstrap/dist/css/bootstrap.min.css');
$style .= api_get_css_asset('fontawesome/css/font-awesome.min.css');
$style = api_get_bootstrap_and_font_awesome();
//$style .= api_get_css_asset('fontawesome/css/font-awesome.min.css');
$style .= api_get_css(ChamiloApi::getEditorDocStylePath());
}

@ -18,10 +18,18 @@ Encore
// Reads the "assets/js/vendor.js" file and it will generate the file public/build/vendor.js file
.addEntry('vendor', './assets/js/vendor.js')
.addEntry('app', './assets/js/app.js')
.addEntry('bootstrap', './assets/js/bootstrap.js')
// Reads app.scss -> output as web/build/css/base.css
.addStyleEntry('css/app', './assets/css/app.scss')
.addStyleEntry('css/bootstrap', './assets/css/bootstrap.scss')
.addStyleEntry('css/chat', './assets/css/chat.css')
.addStyleEntry('css/document', './assets/css/document.css')
.addStyleEntry('css/editor', './assets/css/editor.css')
.addStyleEntry('css/editor_content', './assets/css/editor_content.css')
.addStyleEntry('css/markdown', './assets/css/markdown.css')
.addStyleEntry('css/print', './assets/css/print.css')
.addStyleEntry('css/responsive', './assets/css/responsive.css')
.addStyleEntry('css/scorm', './assets/css/scorm.css')
.enableSourceMaps(!Encore.isProduction())
@ -66,13 +74,12 @@ var themes = [
// Add Chamilo themes
themes.forEach(function (theme) {
Encore.addStyleEntry('css/themes/'+theme+'/default', './assets/css/themes/'+theme+'/default.css')
;
Encore.addStyleEntry('css/themes/' + theme + '/default', './assets/css/themes/' + theme + '/default.css');
// Copy images from themes into public/build
Encore.addPlugin(new copyWebpackPlugin([{
from: 'assets/css/themes/'+theme+'/images',
to: 'css/themes/'+theme+'/images'
from: 'assets/css/themes/' + theme + '/images',
to: 'css/themes/' + theme + '/images'
},
]));
});

Loading…
Cancel
Save