configure assets using function + use runtime.js

This commit is contained in:
Julien Fastré 2019-12-04 14:05:35 +01:00
parent 241815e687
commit 754267e9dd
5 changed files with 51 additions and 36 deletions

View File

@ -65,6 +65,7 @@ Version 1.5.10
- allow to group export in UI
<<<<<<< HEAD
Version 1.5.11
==============
@ -88,3 +89,7 @@ Master branch
- fix search: usage of parenthesis
- add DQL function REPLACE for replacing in strings: "REPLACE(string, 'from', 'to')"
- add function to format phonenumber
- improve `chill_print_or_message` to support date time;
- add a module `show_hide` for javascript;
- load assets using functions ;
- load a `runtime.js` assets for objects shared by webpack ;

36
Resources/public/main.js Normal file
View File

@ -0,0 +1,36 @@
// import jQuery
const $ = require('jquery');
// create global $ and jQuery variables
global.$ = global.jQuery = $;
const moment = require('moment');
global.moment = moment;
const pikaday = require('pikaday-jquery');
const select2 = require('select2');
global.select2 = select2;
// import js
import {chill} from './js/chill.js';
global.chill = chill;
// css
require('./sass/scratch.scss');
require('./css/chillmain.css');
require('./css/pikaday.css');
require('./js/collection/collections.js');
require('./modules/breadcrumb/index.js');
require('./modules/download-report/index.js');
//require('./css/scratch.css');
//require('./css/select2/select2.css');
require('select2/dist/css/select2.css');
require('./modules/select_interactive_loading/index.js');
require('./modules/export-list/export-list.scss');
// img
require('./img/favicon.ico');
require('./img/logo-chill-sans-slogan_white.png');
require('./img/logo-chill-outil-accompagnement_white.png');

View File

@ -15,7 +15,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
<!DOCTYPE html>
<html>
<head>
@ -48,5 +47,7 @@
<p class="forgot-password-link"><a href="{{ path('password_request_recover') }}">{{ 'Forgot your password ?'|trans }}</a></p>
</div>
<script type="text/javascript" src="{{ asset('build/runtime.js') }}"></script>
</body>
</html>

View File

@ -142,6 +142,7 @@
{{ include('@ChillMain/Layout/_footer.html.twig') }}
<script type="text/javascript" src="{{ asset('build/runtime.js') }}"></script>
<script type="text/javascript" src="{{ asset('build/chill.js') }}"></script>
<script type="text/javascript">

View File

@ -1,36 +1,8 @@
// this file loads all assets from the Chill main bundle
// import jQuery
const $ = require('jquery');
// create global $ and jQuery variables
global.$ = global.jQuery = $;
const moment = require('moment');
global.moment = moment;
const pikaday = require('pikaday-jquery');
const select2 = require('select2');
global.select2 = select2;
// import js
import {chill} from './Resources/public/js/chill.js';
global.chill = chill;
// css
require('./Resources/public/sass/scratch.scss');
require('./Resources/public/css/chillmain.css');
require('./Resources/public/css/pikaday.css');
require('./Resources/public/js/collection/collections.js');
require('./Resources/public/modules/breadcrumb/index.js');
require('./Resources/public/modules/download-report/index.js');
//require('./Resources/public/css/scratch.css');
//require('./Resources/public/css/select2/select2.css');
require('select2/dist/css/select2.css');
require('./Resources/public/modules/select_interactive_loading/index.js');
require('./Resources/public/modules/export-list/export-list.scss');
// img
require('./Resources/public/img/favicon.ico');
require('./Resources/public/img/logo-chill-sans-slogan_white.png');
require('./Resources/public/img/logo-chill-outil-accompagnement_white.png');
module.exports = function(encore, entries) {
entries.push(__dirname + '/Resources/public/main.js');
encore.addEntry('login', './vendor/chill-project/main/Resources/public/modules/login_page/index.js');
encore.addAliases({
ShowHide: __dirname + '/Resources/public/modules/show_hide/'
});
};